#include <bits/stdc++.h>
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
constexpr double eps = 1e-9;
constexpr double pi = 3.141592653589793238462643383279;
using namespace std;
using ll = long long;
using ld = long double;
ll gcd(ll a, ll b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll pow(ll x, ll n) {
  x %= 998244353;
  if (n == 0) return 1;
  if (n % 2 == 0)
    return (pow((x * x) % 998244353, n / 2) % 998244353);
  else
    return (x * pow(x, n - 1)) % 998244353;
}
void solve() {}
int main() {
  vector<int> a(5);
  for (int i = 0; i < 5; i++) cin >> a[i];
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    sum += (a[i] - 1) / 10 + 1;
    cout << sum << endl;
  }
  int mini = 9;
  int count = 0;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) count++;
  }
  if (count == 5)
    cout << sum * 10 << endl;
  else {
    for (int i = 0; i < 5; i++) {
      if (a[i] % 10 != 0) {
        mini = min(mini, a[i] % 10);
      }
    }
    cout << sum * 10 - (10 - mini) << endl;
  }
}
