import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a=[int(input()) for _ in [0]*5]
c=9
for i in range(5):
	if int(str(a[i])[-1])==0:
		continue
	c=min(int(str(a[i])[-1]),c)
	
for i in range(5):
	a[i]=(-(-(a[i])//10))*10

if c==0:
	print(sum(a))
else:
	print(sum(a)-(10-c))