A,B,C,D,E=int(input()),int(input()),int(input()),int(input()),int(input())
orders = [A,B,C,D,E]
res = 0
while orders:
  if res % 10 != 0:
    res += (10 - res % 10)
  order = orders.pop(0)
  res += order
print(res)
