a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
n = list(a, b, c, d, e)

n.sort(key=lambda x: x % 10)

for i in range(1, 5):
    n[i] = 10 * (n[i]//10+1)

sm = sum(n)
print(sm)
