#include <bits/stdc++.h>
const double EPS = (1e-10);
using namespace std;
using Int = long long;
const Int MOD = 1000000007;
Int mod_pow(Int x, Int n) {
  Int res = 1;
  while (n > 0) {
    if (n & 1) res = (res * x) % MOD;
    x = (x * x) % MOD;
    n >>= 1;
  }
  return res;
}
template <typename T>
T gcd(T a, T b) {
  return b != 0 ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
bool my_cmp(const int &a, const int &b) {
  if (a % 10 == 0)
    return true;
  else if (b % 10 == 0)
    return false;
  else
    return a % 10 > b % 10;
}
int main() {
  long long food[5];
  for (int i = 0; i < 5; i++) {
    cin >> food[i];
  }
  sort(food, food + 5, my_cmp);
  long long ans = 0;
  for (int i = 0; i < 4; i++) {
    ans += (food[i] + 9) / 10 * 10;
  }
  for (int i = 0; i < 5; i++) {
    cout << food[i] << " ";
  }
  cout << endl;
  ans += food[4];
  cout << ans << endl;
  return 0;
}
