#include <bits/stdc++.h>
int main() {
  int a[5];
  std::cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  int min = 1000, minIdx;
  for (int i = 0; (i < 5); ++i) {
    int lower = a[i] % 10;
    if (lower != 0 && lower < min) {
      min = lower;
      minIdx = i;
    }
  }
  std::cout << minIdx << std::endl;
  int sum = 0;
  for (int i = 0; (i < 5); ++i) {
    if (i == minIdx) continue;
    int time;
    if (a[i] % 10 == 0)
      time = a[i];
    else
      time = a[i] / 10 * 10 + 10;
    std::cout << time << std::endl;
    sum += time;
  }
  sum += a[minIdx];
  std::cout << sum << std::endl;
  return 0;
}
