def Find_maxindex(l):
    size = len(l)
    maxindex = -1
    maximum = 0
    
    for i in range(size):
        if l[i] > maximum:
            maximum = l[i]
            maxindex = i
    
    return maxindex

cookingTime = []
for i in range(5):
    cookingTime.append(int(input()))

remainder = []
for i in range(5):
    remainder.append(cookingTime[i] % 10)

for i in range(5):
    if remainder[i] != 0:
        remainder[i] = 10 - remainder[i]
        
cookingTime_added = []
for i in range(5):
    cookingTime_added.append(cookingTime[i] + remainder[i])

remainder_maxindex = Find_maxindex(remainder)

time = 0
for i in range(5):
    if i != remainder_maxindex:
        time += cookingTime_added[i]

time += cookingTime[remainder_maxindex]

print(time)