a = []
for i in range(5):
    a.append(int(input()))

def kiriage(x):
    n = x % 10
    if n == 0:
        return x
    else:
        return x + 10 - n

n = 0
for i in range(5):
    n += kiriage(a[i])

p = 9
for i in range(5):
    if a[i] % 10 != 0:
        p = min(p, a[i] % 10)

print(n - 10 + p)