num_list = [int(input()) for i in range(5)]

remains = []
divs = []

for num in num_list:
    remains.append(num % 10)
    divs.append(num // 10)

zeros = remains.count(0)

for i in range(remains.count(0)):
    remains.remove(0)

print(sum(divs) * 10 + 40 - zeros * 10 + min(remains))