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

int main(){
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  vector<int> time = {A, B, C, D, E};
  vector<int> amari = {A % 10, B % 10, C % 10, D % 10, E % 10};
  
  int total = 0;
  for (int i : time) {
    if(i % 10 == 0) {
      total += i;
    }
    else {
      total += (i / 10 + 1) * 10;
    }
  }
  
  sort(amari.begin(), amari.end());
  int last;
  for (int i = 0; i < 5; i++) {
    if (amari.at(i) != 0) {
      last = amari.at(i);
      break;
    }
    if (i == 4) {
      last = 10
    }
  }
  cout << total - 10 + last << endl;
}