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

ans.remove(ans[last])

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

