implicit none
integer:: n,a,b,keta,d,total
integer:: i,j
character(5):: s
 
read(*,*) n,a,b
 
total=0
do i=1,n
write(s,'i0') i
 
keta=0
do j=1,len(s)
if(s(j:j)/='')then
read(s(j:j),*) d
keta=keta+d
endif
end do
 
if(keta >= a .and. keta <=b)then
total=total+i
endif
 
end do
 
write(*,*) total
 
end