List = [input() for _ in range(5)]

import math

unitsPlace = []
for i in range(5):
    if int(List[i][-1])!=0:
        unitsPlace.append(int(List[i][-1]))

minUnitsPlace = min(unitsPlace)

ceilList = [math.ceil(int(List[j])/10)*10 for j in range(5)]

res = sum(ceilList) + minUnitsPlace - 10

print(res)