using namespace std;
 
int main(){
  //input
  int ans=0;
  vector<int>vec;
 
  //compute
  for(int i=0;i<5;i++){
    int minutes;
    cin>>minutes;
    if (minutes%10==0){
      ans+=minutes;
    }
    else{
      vec.push_back(minutes%10); 
      ans+=minutes; 
    }    
  }
  sort(vec.begin(),vec.end());
  for(int i=1;i<vec.size();i++){
    ans+=10-vec[i];
  }
  
  
  //output
  cout<<ans<<endl;  
}
  
