#include <bits/stdc++.h>
using namespace std;
int main(void) {
  vector<int> time_data(5);
  int i = 0, time = 0;
  for (i = 0; i < 5; i++) cin >> time_data[i];
  sort(time_data.begin(), time_data.end());
  for (int i = 0; i < 4; i++) {
    if (time % 10 > 0) {
      while (time % 10 > 0) time++;
    }
    time += time_data[i];
  }
  time += time_data[4];
  cout << time << endl;
  return 0;
}
