A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

MIN = 0
ans = 0
for i in (A,B,C,D,E):
    if i % 10 != 0:
        MIN = min(MIN, i % 10)
        ans += i - i % 10 + 10
    else:
        ans += i
ans -= MIN
print(ans)