#include <bits/stdc++.h>
using namespace std;
int main() {
  int time = 0;
  vector<int> dish(5);
  for (int i = 0; i < 5; i++) cin >> dish.at(i);
  int last = dish.at(0);
  for (int i = 0; i < 4; i++) {
    if ((dish.at(i) % 10) > (dish.at(i + 1) % 10)) {
      last = dish.at(i + 1);
    }
  }
  for (int i = 0; i < 5; i++) {
    if (dish.at(i) != last) {
      dish.at(i) /= 10;
      dish.at(i) *= 10;
      dish.at(i) += 10;
      time += dish.at(i);
    } else {
      time += dish.at(i);
    }
  }
  cout << time << endl;
}
