# input
cook_time = []
append = cook_time.append

for i in range(5):
    append(int(input()))

# check
cook_time.sort(key=lambda x: round(x, -1) - x)
res = 0
for c in cook_time:

    if res % 10 != 0:
        res = round(res, -1)

    res += c

print(res)
