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

items = [a, b, c, d, e]
import itertools
import math
min_total = 1000
p = itertools.permutations(items, len(items))
for v in itertools.permutations(items, len(items)):
    total = 0
    print(v)
    for i, item in enumerate(v):
        if i != len(v) - 1:
            total += math.ceil(item / 10) * 10
        else:
            total += item
    min_total = min(min_total, total)
print(min_total)
