x = []
y = []
for i in range(5):
    a = int(input())
    if a % 10 != 0:
        y.append(a % 10)
    if a % 10 != 0:
        a = a + (10 - (a % 10))
    x.append(a)

ans = sum(x)
s = 10 - min(y)

ans -= s

print(ans)