from decimal import Decimal, ROUND_UP
 
l = [int(input()) for _ in range(5)]
min_remainder = 10 - min([x%10 for x in l if x%10 > 0]+[0])
print(sum([int(Decimal(x).quantize(Decimal("1E1"), rounding=ROUND_UP)) for x in l]) - min_remainder)