#include <bits/stdc++.h>
using namespace std;
int main() {
  pair<int, int> a[5];
  int tempans = 0, cnttemp = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i].second;
    if (a[i].second % 10 == 0) {
      tempans += a[i].second;
      a[i].first = 0;
      cnttemp++;
      continue;
    }
    a[i].first = (a[i].second) % 10;
  }
  sort(a, a + 5);
  for (int i = 4; i >= 0; i--) {
    cout << a[i].second << endl;
  }
  cout << endl;
  int ans = 0, temp = 0;
  for (int i = 4; i > cnttemp; i--) {
    temp = a[i].second;
    ans += (temp + 10) - temp % 10;
  }
  cout << ans + tempans + a[cnttemp].second << endl;
  return 0;
}
