#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(5);
  vector<int> b(5);
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    b[i] = a[i] % 10;
  }
  for (int j = 0; j < 5; j++) {
    for (int i = 0; i < 3; i++) {
      if (b[i] > b[i + 1]) {
        int temp = a[i + 1];
        a[i + 1] = a[i];
        a[i] = temp;
        temp = b[i + 1];
        b[i + 1] = b[i];
        b[i] = temp;
      }
    }
  }
  int ans = a[0];
  for (int i = 1; i < 5; i++) {
    cout << ans << endl;
    ans += a[i] - b[i] + 10;
  }
  cout << ans;
  return 0;
}
