#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  vector<int> array;
  array.push_back(a);
  array.push_back(b);
  array.push_back(c);
  array.push_back(d);
  array.push_back(e);
  int min = 10;
  int min_i = 0;
  for (int i = 0; i < array.size(); i++) {
    int tmp = array[i] % 10;
    if (min > tmp && tmp != 0) {
      min = tmp;
      min_i = i;
    }
  }
  swap(array[array.size() - 1], array[min_i]);
  int res = 0;
  for (int i = 0; i < array.size(); i++) {
    res += array[i];
    if (i == array.size() - 1) break;
    if (res % 10 == 0) {
      cout << res << endl;
      continue;
    } else {
      res += 10 - res % 10;
    }
    cout << res << endl;
  }
  cout << res << endl;
  return 0;
}
