program atcoder
    implicit none
    integer :: N, A, B, i, s
    integer :: counter = 0

    read *, N, A, B
    do i = 1, N
        s = KetaSum(i)
        if((s .ge. A) .and. (s .le. B)) then
            counter = counter + i
        endif
    enddo
    print '(i0)', counter

    stop
    contains
        function KetaSum(x) result(y)
            implicit none
            integer, intent(in) :: x
            integer, allocatable :: array(:)
            integer :: s, c1, i, y

            s = int(log10(real(x)))+1
            allocate(array(s))
            do i = 1, s
                c1 = i - 1
                array(i) = int(x/(10**c1)) - int(x/(10**i)) * 10
            enddo
            y = sum(array)
            deallocate(array)

            return
        endfunction

endprogram atcoder
