#include <bits/stdc++.h>
using namespace std;
int mintime = INT16_MAX;
int A[5];
int main() {
  int sum = 0;
  for (int(i) = (0); (i) < (5); ++(i)) {
    cin >> A[i];
  }
  sort(A, A + 5,
       [](int x, int y) -> bool { return ((x - 1) % 10 > (y - 1) % 10); });
  for (int(i) = (0); (i) < (4); ++(i)) {
    sum += (A[i] + (10 - 1)) / 10 * 10;
  }
  sum += A[4];
  for (int(i) = (0); (i) < (5); ++(i)) {
    cout << (A[i]) << endl;
  }
  cout << (sum) << endl;
  return 0;
}
