#include <bits/stdc++.h>
int main() {
  int a = 0;
  int b = 0;
  int c = 0;
  int d = 0;
  int e = 0;
  int time = 0;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &e);
  time += a;
  for (int i = 0;; i++) {
    if (time % 10 == 0) {
      break;
    } else {
      time += 1;
    }
  }
  printf("1回目：%d\n", time);
  time += b;
  for (int i = 0;; i++) {
    if (time % 10 == 0) {
      break;
    } else {
      time += 1;
    }
  }
  printf("2回目：%d\n", time);
  time += c;
  for (int i = 0;; i++) {
    if (time % 10 == 0) {
      break;
    } else {
      time += 1;
    }
  }
  printf("3回目：%d\n", time);
  time += d;
  for (int i = 0;; i++) {
    if (time % 10 == 0) {
      break;
    } else {
      time += 1;
    }
  }
  printf("4回目：%d\n", time);
  time += e;
  printf("%d", time);
  return 0;
}
