#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> time(5);
  for (int i = 0; i < 5; i++) {
    cin >> time.at(i);
  }
  vector<int> jouyo(5);
  for (int i = 0; i < 5; i++) {
    jouyo.at(i) = time.at(i) % 10;
  }
  int min = 10;
  int count = 0;
  for (int i = 0; i < 5; i++) {
    if (jouyo.at(i) < min) {
      min = jouyo.at(i);
      count = i;
    }
  }
  int goukei = 0;
  for (int i = 0; i < 5; i++) {
    goukei += (time.at(i) / 10 + 1) * 10;
  }
  goukei -= (time.at(count) / 10 + 1) * 10;
  goukei += time.at(count);
  cout << goukei << endl;
}
