A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
tmp = 9
last = 0
for i in [A, B, C, D, E]:
    if i % 10 == 0:
        continue
    else:
        if i % 10 < tmp:
            tmp = i % 10
            last = i

ans = 0
for i in [A, B, C, D, E]:
    if i % 10 == 0:
        ans += i
    else:
        ans += i + (10-i%10)

print(ans-(10-last%10) if last != 0 else ans)