import math

list = []
for i in range(5):
    list.append(int(input()))
sum = 0
zeroList = [list[i] for i in range(len(list)) if list[i]%10 == 0]
otherList = [list[i] for i in range(len(list)) if not list[i]%10 == 0]
def func(x):
    return x % 10
otherList.sort(key=func)
for i in range(len(zeroList)):
    sum += zeroList[i]
for i in (otherList[1:]):
    sum += math.ceil(i/10)*10
sum += otherList[0]
print(sum)
