a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

# 1のくらいが最も小さいものを最後に注文する

a1 = a%10
b1 = b%10
c1 = c%10
d1 = d%10
e1 = e%10

times = [a,b,c,d,e]
ones = [a1,b1,c1,d1,e1]

# 全て一緒の場合、
#if len(list(set(ones))) == 1:

ones = [10 if i==0 else i for i in ones]

sum = 0

min_index = ones.index(min(ones))
sum += times[min_index]
del times[min_index]
for i in times:
	# 1のくらいは切り上げ: 28
	if i%10==0:
		sum += i
	else:
		sum += (i//10+1)*10
	print(sum)

print(sum)