dish = [int(input()) for d in range(5)]
tmp = 0
time = []
for index,d in enumerate(dish):
  if d % 10 != 0:
    d10 = ((d // 10) +1) * 10
    time.append(d10)
    if tmp <= (d10-d):
      tmp = d10 - d
      last = index  
  else:
    time.append(d)
del time[last]
print(sum(time)+dish[last])