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

int main(){
  vector<int> a(5),b(5);
  int count = 4, plus;
  for(int i = 0; i < 5; i++){
    cin >> a.at(i);
    b.at(i) = a.at(i) / 10; 
  }
  sort(b.begin(),b.end());
  for(int i = 0; i < 5; i++){
    if(b.at(i) != 0){
      plus = b.at(i)
      break;
    }
  }
  
  for(int i = 0; i < 5; i++){
    count += b.at(i);
  }
  cout << count * 10 + plus ;
}
