a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dish = [a,b,c,d,e]
dish = sorted(dish, key = lambda x: x % 10 , reverse = True)

temp = dish[0]
for i in range(1,5):
    temp = (temp // 10 + 1) * 10 + dish[i]
    
print(temp)   