#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int serve_time[5];
  int total_time = 0;
  for (int i = 0; i < 5; i++) {
    cin >> serve_time[i];
    total_time += serve_time[i];
  }
  int dead_time[5];
  for (int i = 0; i < 5; i++) {
    if ((serve_time[i] % 10) != 0) {
      dead_time[i] = 10 - (serve_time[i] % 10);
    } else {
      dead_time[i] = 0;
    }
    total_time += dead_time[i];
  }
  for (int i = 0; i < 5; i++) cout << dead_time[i] << endl;
  int max_deadtime = 0;
  for (int i = 0; i < 5; i++) {
    if (max_deadtime < dead_time[i]) {
      max_deadtime = dead_time[i];
    }
  }
  total_time -= max_deadtime;
  cout << total_time << endl;
  return 0;
}
