list = []
indent = 0
memory = 9
for i in range(5):
  list.append(int(input()))
  if memory > list[i] % 10 and list[i] % 10 > 0:
    indent = i
    memory = list[i] % 10

count = 0
for i in range(5):
  if i == indent:
    count += list[i]
  else:
    count += 10 * (int(list[i]/10) + 1)

print(count)