#include <bits/stdc++.h>
using namespace std;
void swap(int *x, int *y) {
  int temp = *x;
  *x = *y;
  *y = temp;
}
void bubble_sort(int a[]) {
  int i;
  int j;
  for (j = 0; j < 5; j++) {
    for (i = 5 - 1; i > 0; i--) {
      if (((a[i - 1] - 1) % 10 > (a[i] - 1) % 10)) {
        swap(&a[i], &a[i - 1]);
      }
    }
  }
}
int main(void) {
  int t = 0;
  int i;
  int a[5];
  for (i = 0; i < 5; i++) {
    cin >> a[i];
  }
  bubble_sort(a);
  for (i = 4; i > 0; i--) {
    cout << a[i] << "\n";
    if (a[i] % 10 > 0)
      t += a[i] + (10 - a[i] % 10);
    else
      t += a[i];
  }
  t += a[0];
  cout << t;
  return 0;
}
