#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  vector<int> vec = {A, B, C, D, E};
  int min = 10;
  for (int i = 0; i < vec.size(); i++) {
    if (vec.at(i) != 0 && min >= vec.at(i) % 10) {
      min = vec.at(i) % 10;
    }
    int sum1 = 0;
    int sum2 = 0;
    int sum3 = 0;
    for (int j = 0; j < vec.at(i); j++) {
      if (vec.at(j) % 10 != 0 && vec.at(j) % 10 != min) {
        vec.at(j) += sum1;
        int a = vec.at(j) % 10;
        a += sum2;
        sum3++;
      } else {
        vec.at(j) += sum1;
      }
    }
    cout << sum1 + 10 * sum3 - sum2 << endl;
  }
}
