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

ans = 0
for i, a in enumerate(abcde):
    if a % 10 == 0:
        ans += a
        abcde.pop(i)

b = abcde[0]
for a in abcde:
    if a % 10 < b:
        b = a % 10
    ans -= a % 10
    ans += a + 10
b = 10 - b

ans -= b
print(ans)
