t = 10
last = 0
ans = []
food=[]
for _ in range(5):
    food.append(input(int()))

for i in range(5):
    if t > int(str(food[i])[-1]) and int(str(food[i])[-1]) != 0:
        t = int(str(food[i])[-1])
        last = i
# print(food[last])
last = food.pop(last)

for j in food:
    x = 10-int(str(j)[-1])
    if x == 10:
        x = 0
    ans.append(int(j)+x)

# print(ans)
print(sum(ans)+int(last))
