module global_variables
end module global_variables
program main
  use global_variables
  implicit none
  integer::i,j,k,n,a,b,res
  read *, n,a,b
  res = 0
  do i=1,n
    j = i
    k = 0
    do while (j > 0)
      k = k + mod(j,10)
      j = j/10
    enddo
    if (a <= k .and. k <= b) then
      res = res + i
    endif
  enddo
  print '(i0)', res
end program main
