#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[5], index = 0, max = 10, sum = 0;
  for (int i = 0; i < 5; i++) cin >> A[i];
  cout << endl;
  for (int i = 0; i < 5; i++) {
    if (max > A[i] % 10 && A[i] % 10 != 0) {
      max = A[i] % 10;
      index = i;
    }
  }
  cout << max << endl;
  cout << endl;
  for (int i = 0; i < 5; i++) {
    if (i == index) continue;
    if (sum % 10 != 0) sum += (10 - sum % 10);
    sum += A[i];
    cout << sum << endl;
    cout << endl;
  }
  if (sum % 10 != 0) sum += (10 - sum % 10);
  sum += A[index];
  cout << sum << endl;
}
