#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  int a, b, c, d, e, x;
  int f, h;
  x = 0;
  char c1;
  string s;
  int a1[5];
  f = 0;
  h = 10;
  for (int i = 0; i < 5; i++) {
    cin >> a1[i];
  }
  for (int i = 0; i < 5; i++) {
    if (a1[i] % 10 != 0 && a1[i] % 10 <= h) {
      h = a1[i] % 10;
      f = i;
    }
  }
  cout << a1[f];
  for (int i = 0; i < 5; i++) {
    if (i == f) {
      continue;
    }
    x += a1[i];
    cout << x << endl;
    if (a1[i] % 10 != 0) {
      while (x % 10 != 1) {
        x++;
      }
    }
  }
  x = x + s[f];
  cout << x;
}
