list = []
indent = 0
for i in range(5):
  memory = 9
  list.append(int(input()))
  if memory > list[i] % 10:
  	indent = i
 
count = 0
for i in range(5):
  if i == indent:
    count += list[i]
  else:
    count += 10 * (int(list[i]//10) + 1)
 
print(count)