num = []
for i in range(5):
    num.append(int(input()))

best_min = 10
for idx, i in enumerate(num):
    if i % 10 != 0:
        if i % 10 < best_min:
            best_min = i % 10
            index = idx
count = 0
for idx, i in enumerate(num):
    if idx == index:
        count += i
    else:
        if i % 10 == 0:
            count += i
        else:
            count += i + 10 - (i%10)
print(count)