import math
ae = [int(input()) for _ in range(5)]
min_ae = 9
num = 0
for a in ae:
    s = str(a)
    if s[-1] == "0":
        pass
    else:
        min_ae = min(int(s[-1]), min_ae)
    if min_ae==int(s[-1]):
        num = a
ae.remove(num)
ceil_ae = [math.ceil(a/10)*10 for a in ae]
print(num + sum(ceil_ae))
