'''input
123
123
123
123
123
'''

a=[]

for i in range(5):
	a.append(int(input()))
# print(a)
flag=[]

for i in range(5):
	if a[i]%10!=0:
		flag.append(a[i]%10)
	else:
		flag.append(-1)
# print(flag)

endInd=float('inf')
end=float('inf')

for i in range(5):
	if flag[i]>0 and end>flag[i]:
		end=flag[i]
		endInd=i
# print(a[endInd])

if endInd=='inf':
	print(sum(a))
else:
	s=a[endInd]
	# print(s)
	a.pop(endInd)
	flag.pop(endInd)
	# print(a)
	for i in range(4):
		if flag[i]>0:
			a[i]=(a[i]//10+1)*10
	# print(a)
	s+=sum(a)
	print(s)
