program ABC_083_B_SomeSums
   implicit none
   integer N, A, B, v, Sumrank, co, i, j, k, l
   read(*, *) N, A, B
   co = 0
   do l = 0, 1
       do k = 0,9
           do j = 0, 9
               do i = 0, 9
                  v = i + 10*j + 100*k + 1000*l
				  Sumrank = i + j + k + l
	              if( v > N ) then
	                  goto 1
	              else if( (A <= Sumrank) .and. (Sumrank <= B) ) then
                      co = co + v
                  end if
               end do
		   end do
	   end do
   end do
   1 continue
   write(*, *) co
end  program ABC_083_B_SomeSums