#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e+17;
const long long MODcdf = 998244353;
bool pairCompare(const pair<long long, long long>& firstElof,
                 const pair<long long, long long>& secondElof) {
  return firstElof.first < secondElof.first;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  long long a[5];
  long long mod[5];
  long long lst = INF;
  long long pin;
  long long ndt[5];
  for (long long i = 0; i < 5; i++) ndt[i] = 0;
  for (long long i = 0; i < 5; i++) {
    cin >> a[i];
    mod[i] = a[i] % 10;
    if (lst > mod[i] && mod[i] != 0) {
      lst = mod[i];
      pin = i;
    }
    if (mod[i] == 0) {
      ndt[i] = a[i];
      continue;
    }
    ndt[i] = a[i] + 10 - (a[i] % 10);
  }
  ndt[pin] = 0;
  for (long long i = 0; i < 5; i++) {
    cout << ndt[i] << " ";
  }
  cout << endl;
  cout << a[pin] << endl;
  long long ans = 0;
  for (long long i = 0; i < 5; i++) {
    ans += ndt[i];
  }
  ans += a[pin];
  cout << ans << endl;
}
