#include <bits/stdc++.h>
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
using namespace std;
int main() {
  int r[5];
  vector<int> s;
  long long t = 0;
  int m = 20;
  int p;
  for (int i = 0; i < (int)(5); i++) {
    int b;
    cin >> b;
    r[i] = b;
    if ((b % 10) < m && (b % 10 != 0)) {
      p = b;
      m = b % 10;
    }
  }
  int flag = 0;
  for (int i = 0; i < (int)(5); i++) {
    if ((r[i] == p) && flag == 0) {
      flag = 1;
      continue;
    } else {
      s.push_back(r[i]);
    }
  }
  for (int i = 0; i < (int)(4); i++) {
    if (t % 10 == 0)
      t += s[i];
    else {
      t += (10 - (t % 10));
      t += s[i];
    }
    cout << t << endl;
  }
  t += (10 - (t % 10));
  t += p;
  cout << t;
}
