a = [[0, int(input())] for i in range(5)]

for i in range(5):
    a[i][0] = a[i][1] % 10
    if a[i][0] == 0:
        a[i][0] = 10
        a[i][1] -= 10

a.sort(reverse=True)

ans = 0
for i in range(4):
    if a[i][0] == 10:
        ans += a[i][1] + 10
    else:
        ans += a[i][1] + (10 - a[i][0])

ans += a[4][1]

print(ans)
