a,b=list(map(int,input().split()))
cnt=0
lis=[]
for x in range(a,b+1):
x=str(x)
sumn=0
for i in range(len(x)):
sumn+=int(x[i])
if sumn%5==0:
cnt+=1
else:
continue
print(cnt)
a,b=list(map(int,input().split()))
cnt=0
lis=[]
for x in range(a,b+1):
x=str(x)
sumn=0
for i in range(len(x)):
sumn+=int(x[i])
if sumn%5==0:
cnt+=1
else:
continue
print(cnt)