a = []
for i in range(5):
    a.append(input())
minn = 9
flag = 1
sumtime = 0
for i in range(5):
	if(minn > a[i]%10 & a[i]%10 > 0):
		minn = a[i]%10
		flag = 0
	if(a[i]%10 == 0):
		sumtime += a[i]
	else:
		a[i] = a[i] + 10 - a[i]%10
		sumtime += a[i]
if(flag == 1):
	print(sumtime)
else:
	print(sumtime - 10 + minn)