from functools import reduce
l = [int(input()) for _ in range(5)]
a = min([i % 10 for i in l if i % 10 != 0])
l = [i if i % 10 != 0 else i + 10 for i in l ]
ceil = lambda n: n // 10 * 10
print(reduce(lambda a, b: ceil(a) + ceil(b), l) + a)
