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


ans.remove(ans[last])

print(sum(ans)+dish[last])