#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  vector<int>t(5);
  vector<int>s(5);
  int ans = 0;
  for(int i = 0;i < 5;i++){
    cin >> t[i];
  }			//代入
  for(int i = 0;i < 5;i++){
    if(t[i] % 10 == 0){
      ans += t[i];
    }else{
      ans += (t[i] / 10 + 1) * 10;
      s[i] = t[i]%10
    }
  }
  cout << ans - (10 - min({s[0],s[1],s[2],s[3],s[4]})) << endl;
}