#include<iostream>
using namespace std;
void main(){
  int sum=0;
  int last=10;
  int t;
  for(int i=0;i<5;i++){
    cin>>t;
    if(!t%10){
      sum+=t;
      continue;
    }
    sum+=(t/10+1)*10;
    last=last<t%10? t%10:last;
  }
  cout<<sum-10+last<<endl;
}