a = int(input())                                                        
b = int(input())                                                        
c = int(input())                                                        
d = int(input())                                                        
e = int(input())                                                        
                                                                        
orders = [a, b, c, d, e]                                                
orders = list(map(str, orders))                                         
orders = sorted(orders, key=lambda x:int(x[-1]))                        
                                                                        
a = []                                                                  
b = []                                                                  
for order in orders:                                                    
    if order[-1] == "0":                                                
        a.append(int(order))                                            
    else:                                                               
        b.append(order)                                                 
                                                                        
o = sum(a) + int(b[0]) + sum([10-int(_b[-1])+int(_b) for _b in b[1:]])  
print(o) 