lst = [input() for _ in range(5)]
check = float("inf")
last_num = 0

for i in lst:
    if int(i[-1]) != 0 and int(i[-1]) < check:
        check = int(i[-1])
        last_num = i

lst.remove(last_num)

for i in range(4):
    if int(lst[i]) % 10  != 0:
        lst[i] = (int(lst[i]) + (10 - int(lst[i]) % 10))

print(sum(list(map(int,lst))) + int(last_num))