#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> menu(5);
  for (int i = 0; i < 5; i++) {
    cin >> menu[i];
  }
  int n, m;
  int sum = 0;
  int res = 0;
  for (int i = 0; i < 5; i++) {
    n = menu[i] % 10;
    if (n == 0) {
      sum += menu[i];
    } else {
      m = 10 - n;
      sum += menu[i] + m;
      res = max(res, m);
    }
    cout << sum << endl;
  }
  cout << sum - res << endl;
  return 0;
}
