#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  vector<int> time(5);
  for (int i = 0; i < (5); ++i) cin >> time[i];
  vector<int> si = time;
  for (int i = 0; i < (5); ++i) {
    si[i] %= 10;
  }
  for (int i = 0; i < (5); ++i) {
    if (time[i] % 10 != 0) time[i] += (10 - si[i]);
  }
  sort(si.begin(), si.end());
  for (int i = 0; i < (5); ++i) cout << time[i] << endl;
  if (si[0] != 0) {
    cout << si[0] + time[0] + time[1] + time[2] + time[3] + time[4] - 10
         << endl;
    return 0;
  } else {
    for (int i = 0; i < (5); ++i) {
      if (si[i] != 0) {
        cout << si[i] + time[0] + time[1] + time[2] + time[3] + time[4] - 10
             << endl;
        return 0;
      }
    }
    cout << time[0] + time[1] + time[2] + time[3] + time[4] - 10 << endl;
    return 0;
  }
}
