a = [int(input()) for i in range(5)]
b = [g%10 for g in a]
kkk = 9
h = 0
for i in range(len(a)):
    g = a[i] % 10
    if g > 0 and g < kkk:
        kkk = g
        h = i
l = a[h]
a.pop(h)
a.append(l)
print(a)
total = 0
for i in a:
    if total % 10 != 0:
        total += 10 - (total % 10)
    total += i

print(total)
