t = 0
l = [int(input()) for i in range(5)]
min1 = 9
minN = 0
for i in l:
    if i%10 != 0:
        if i%10 < min1:
            min1 = i%10
            minN = i
l.remove(minN)
l.append(minN)

for i in range(5):
    if(l[i]%10 != 0 and i != 4):
        t += int(l[i]/10) * 10 + 10

    elif l[i]%10 == 0 or i == 4:
        t += l[i]
    
print(t) 
        
