import math
a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
t = []
b = []
u = []
for i in a:
	if(i%10 == 0):
		b.append(i)
	else:
		t.append(i)
		u.append(i%10)
min_t = u.index(min(u))
ss = t.pop(min_t)
u.pop(min_t)

for i in range(len(t)): 
	u[i] = 10 - u[i]
	t[i] = t[i] + u[i]
print(sum(b) + sum(t) + ss)