a=[]
ra=[]
for i in range(5):
  a.append(int(input()))

for i in range(5):
  ra.append(a[i]%10)

tot=0
for i in range(5):
  if ra[i]==0:
    tot+=a[i]

  else:
    tot+=a[i]+10-ra[i]


ra.sort()
for i in range(5):
  if ra[i]==0:
    continue
  else:
    tot-=ra[i]
    break
print(tot)