#include <bits/stdc++.h>
int main() {
  int tim[5], i, j, k, ans = 0;
  for (i = 0; i < 5; i++) {
    scanf("%d", &tim[i]);
  }
  int max, sequence[5], max_sequence;
  int *chk = (int *)calloc(6, sizeof(int));
  for (i = 0; i < 5; i++) {
    max = 0;
    for (j = 0; j < 5; j++) {
      if (((tim[j] % 10 >= max) || tim[j] % 10 == 0) && (chk[j] == 0)) {
        max = tim[j] % 10;
        if (tim[j] % 10 == 0) max = 10000;
        max_sequence = j;
      }
    }
    sequence[i] = max_sequence;
    chk[max_sequence] = 1;
  }
  for (i = 0; i < 5; i++) {
    printf("%d\n", tim[sequence[i]]);
  }
  for (i = 0; i < 5; i++) {
    ans += tim[sequence[i]];
    if ((tim[sequence[i]] % 10 != 0) && i != 4) {
      ans += (10 - tim[sequence[i]] % 10);
    }
  }
  printf("%d", ans);
  return 0;
}
