#include<bits/stdc++.h>
using namespace std;

int main(){
vector<int>a(5);
  int b,c;
  b=10;
  c=0;
  for(int i=0;i<5;i++){
  cin>>a[i];
    if(a[i]%10==0){
      c=c+a[i];
        }
    else{
    c=c+(a[i]/10+1)*10;
      b=min(b,a[i]%10)
    }
    }
  
  cout<<c-10+b<<endl;
     }

       cout<<c+1<<endl;
}
