#include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> A(5);
  for(int i=0;i<5;i++){
  cin>>A[i];
    a[i]=(10-A[i]%10)*-1;
   
    
    
  }
  int count=0;
  A[i]=a[i];
  sort(a[i],a+5);
  for(int i=0;i<N;i++){
    count+=A[i];
  }
  
cout<<count<<endl;
}
