import sys

dishes = [int(line.strip()) for line in sys.stdin]
min1 = None
for d in dishes:
  if not min1:
    min1 = d%10
  elif 0 < d%10 < min1:
    min1 = d%10
    
dishes = [((d+9)//10)*10 for d in dishes]
print(sum(dishes)-(10-min1))
