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

for i in range(5):
    amari.append([time_list[i] // 10, time_list[i] % 10])
    
small = 9
for i in range(5):
    if amari[i][1] > 0 and amari[i][1] < small:
        small = amari[i][1]
        number = i
        
#print (amari)
total_time = 0
for i in range(5):
    if i != number:
        if amari[i][1] == 0:
            total_time += amari[i][0] * 10
        else:
            total_time += amari[i][0] * 10 + 10
    else:
        total_time += time_list[i]
        
print(total_time)
#print (amari)
# print(time_list)