import math
food = [int(input()) for i in range(5)]

for i in range(4):
    for j in range(i + 1, 5):
        if food[i] % 10 < food[j] % 10:
            sub = food[i]
            food[i] = food[j]
            food[j] = sub

ans = 0
for i in range(4):
    ans += math.ceil(food[i] / 10) * 10
ans += food[4]

print(ans)