import math
 
num = [int(input()) for _ in range(5)]
num2 = [n if n % 10 == 0 else n - (n%10) + 10  for n in num]

c = []
for i, j  in enumerate(num):
	n = j
	for k,l in enumerate(num2):
		if  k == i:
			continue
        else:
			n += l
	c.append(n)

print(min(c))
