# coding: utf-8
# Your code here!

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

minr = 9
minf = 0
for f in food:
    if f % 10 != 0 :
        if f % 10 < minr :
            minr = f % 10
            minf = f

food.remove(minf)
food.append(minf)

sumf = 0
i = 0
for f in food:
    if i == 4:
        sumf += f
    elif f % 10 != 0:
        sumf += int(f/10) * 10 + 10
    else:
        sumf += f
    i+=1
print(sumf)