import itertools

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dish = [a, b, c, d, e]
dishp = list(itertools.permutations(dish, 5))
t = []
x = 0
for i in range(0,120):
    x = 0
    for j in range(0,4):
        if dishp[i][j] %10 == 0:
            x += dishp[i][j]
        else:
            x += (dishp[i][j] // 10 +1) * 10
    x += dishp[i][4]
    t.append(x)

print(t)
print(min(t))
