def addTime(n):
    keta = n%10
    if keta == 0:
        return n
    return n+10 - keta

def calcKeta(n):
    if n%10!=0:
        return n
    return 10

food = [int(input()) for _ in range(5)]
foods = sorted(food,key=calcKeta,reverse=True)
min_food_time = foods[0]
foods.remove(min_food_time)
print(sum(list(map(addTime,foods)))+min_food_time)