a = [list(map(int, input().split())) for _ in range(5)]
mod = 9
ans = 0

for i in range(5):
    modi = (a[i][0]%10)
    if modi != 0:
        mod = min(mod, modi)
    ref = (0 - -a[i][0]//10)*10
    ans += ref

mod = 10 - mod
ans = ans - mod
print(ans)