#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)

int main(){
  int ans=0;
  vector<int> x(5,0),y(5,0);
  REP(i,5){
    cin>>x.at(i);
    ans+=((x.at(i)-1)/10+1)*10;
    y.at(i)=(x.at(i)-1)%10;
  }
  sort(y.begin(),y.end());
  ans-=(9-y.at(0));
  cout<<ans;
}