# B - Five Dishes
import math

price = []

for i in range(5):
    price.append(int(input()))

kiriage = [10*(math.ceil(i/10)) for i in price]

amari = [i%10 for i in price]

while min(amari) == 0:
    amari.remove(0)
    
  

print(sum(kiriage)-10+ min(amari))