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

mi = min(t % 10 for t in [a, b, c, d, e] if t % 10 != 0)
# print(mi)

# print([wt + (10 - (wt % 10)) if wt % 10 != 0 else wt for wt in [a, b, c, d, e]])
print(sum([wt + (10 - (wt % 10)) if wt % 10 != 0 else wt for wt in [a, b, c, d, e]]) - 10 + mi)