l = [input() for _ in range(5)]
l_d1 = [int(li[-1]) for li in l]
num0 = l_d1.count(0)
for _ in range(num0):
    l_d1.remove(0)
min_d1 = l_d1.pop(l_d1.index(min(l_d1)))
time = sum([int(li) // 10 for li in l]) * 10
time += len(l_d1) * 10
time += min_d1
print(time)