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

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

rmin=10
mi=10
for i in range(5):
  if ra[i]!=0 and ra[i]<rmin:
    rmin=ra[i]
    mi=i
    
mintime=0
for i in range(5):
  if ra[i]==0:
    mintime+=a[i]
  else:
    mintime+=a[i]+10-ra[i]
mintime-=10-ra[mi]
print(mintime)