a = list(int(i) for i in input().split())  
b=[]
c=[]
d=0
sum=0
for i in range(5):
  c.append(a[i]%10) 
  if a[i]%10==0:
      b.append((a[i]//10)*10)
      c.append(a[i]%10+10) 
  else:
    b.append((a[i]//10+1)*10)
    c.append(a[i]%10) 
for i in ragne(5):
  if c[i]!=min(c):
    sum+=a[i]
  else:
    d+=i
print(sum+a[d])
  
     
      

  