dish = []
time = 0
for i in range(5):
    temp = int(input())
    if temp % 10:
        dish.append(temp)
    else:
        time += temp
left = 10 - min([x % 10 for x in dish])
for i in range(len(dish)):
    dish[i] = dish[i] + 10 - dish[i] % 10
time = time + sum(dish) - left
print(time)