xs = [int(input()) for i in range(5)]
ps = []
for x in xs:
	ps.append(((x-1)%10+1, x))
ps.sort()
ans = 0
ans += ps[0][1]
for i in range(1, 5):
	print(ps[i])
	ans += (ps[i][1] + 9) // 10 * 10
print(ans)
