import math
cookT = {}
for i in range(5):
  cookT[i] = int(input())

lastOrder = min(cookT.items(), key=lambda x:x[1]%10)[0]

totalT = 0
for i in range(5):
  if i == lastOrder:
    totalT += cookT[lastOrder]
  else:
    tempX = cookT[i]
    tempY = math.ceil(tempX%10 / 10)*10
    totalT += tempX//10 *10 + tempY

print(totalT)