array = []                                         
raw = raw_input()                                  
array.append(int(raw))                             
raw = raw_input()                                  
array.append(int(raw))                             
raw = raw_input()                                  
array.append(int(raw))                             
raw = raw_input()                                  
array.append(int(raw))                             
raw = raw_input()                                  
array.append(int(raw))                             

total = 0                                          
last = 10                                          
for i in range(5):                                 
    n = array[i]                                   
    t = n / 10                                     
    total = total + t * 10                         
    l = n % 10
    if l!= 0:                                      
        total = total + 10                         
    if l != 0 and l < last:
        last = l                                   
total = total + last                               
print total - 10  