# coding: utf-8
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
Ac=(a//10+1)*10
Bc=(b//10+1)*10
Cc=(c//10+1)*10
Dc=(d//10+1)*10
Ec=(e//10+1)*10
Af=a%10
Bf=b%10
Cf=c%10
Df=d%10
Ef=e%10

if max(Af,Bf,Cf,Df,Ef)==Af:
  print(a+Bc+Cc+Dc+Ec)
  
elif max(Af,Bf,Cf,Df,Ef)==Bf:
  print(Ac+b+Cc+Dc+Ec)
  
elif max(Af,Bf,Cf,Df,Ef)==Cf:
  print(Ac+Bc+c+Dc+Ec)  
  
elif max(Af,Bf,Cf,Df,Ef)==Df:
  print(Ac+Bc+Cc+d+Ec)
  
elif max(Af,Bf,Cf,Df,Ef)==Ef:
  print(Ac+Bc+Cc+Dc+e)  