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 = sum((/(mod(i/(10**k),10),k=0,4)/))
    if (j < a .or. j > b) cycle
    res = res + i
  enddo
  print '(i0)', res
end program main

