order = [int(input()) for _ in range(5)]
min_digit = 0
time = 0
for i in range(len(order)):
  if order[i]%10!=0:
    time+=(order[i]//10+1)*10
  else:
    time+=order[i]

order_digit = [i%10 for i in order]
if order_digit == [0,0,0,0,0]:
  print (time-10+min_digit)
else:
  for i in range(len(order)):
    digit = order[i]%10
    if min_digit>=digit and digit!=0:
    min_digit=digit