a = [int(input()) for _ in range(5)]
b = sorted(a, key = lambda x: x%10)
c = [(i, b[i]) for i in range(5)]
num = [1,2,3,4,5,6,7,8,9,0]
x = 0
ans = 0
for i, value in c:
    if value%10 == 0:
        ans += value
    else:
        x = i
        break
for i in range(x+1, 5):
    ans += (c[i][1] + (10 - c[i][1]%10))
print(ans + c[x][1])
