menu = []
for i in range(5):
    menu.append(int(input()))

menu_kiriage = []
min_reminder = 10
for i in range(5):
    reminder = menu[i]%10
    if reminder < min_reminder and reminder != 0:
        min_reminder = reminder
        min_menu = i

total = 0
for i in range(5):
    if min_menu == i:
        total += menu[i]
    else:
        total += menu[i]+10-menu[i]%10 if menu[i]%10 != 0 else menu[i]
        
print(total)