implicit none
INTEGER :: n,i,j,count,a,b,keta_sum,s_int
CHARACTER(5) :: s
READ(5,*) n,a,b

count = 0

do i=1,n
    keta_sum = 0
    WRITE(s,"(i0)") i

    do j=1,len(s)
        if (s(j:j)/="") then
            READ(s(j:j),*) s_int
            keta_sum = keta_sum+s_int
        endif
    enddo

    if (keta_sum>=a .and. b>=keta_sum) then
        count = count+i
    endif

enddo

WRITE(6,*) count

end
