a = [0]*5
for i in range(len(a)):
  a[i] = int(input())
for i in range(0,len(a)-1):
  for j in range(len(a)-1,i,-1):
    if(a[j-1]%10 < a[j]%10):
      temp = a[j]
      a[j] = a[j-1]
      a[j-1] = temp
for i in range(len(a)):
  if(a[i]%10 != 0 and i != len(a)-1):
    a[i] = a[i]+(10 - a[i]%10)
print(sum(a))