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

l = [a, b, c, d, e]
order_l = []

for i in l:
    j = round(i, -1)
    i = j - i
    order_l.append(i)

max_order = max(order_l)
k = order_l.index(max_order)
l.append(l[k])
l.pop(k)

order_l.append(order_l[k])
order_l.pop(k)

ans = sum(l) + sum(order_l) - order_l[4]
print(ans)