#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int sum = 0;
  int max_differential = 0;
  const int p[5] = {A, B, C, D, E};
  int differential[5] = {};
  int duty = 0;
  for (int i = 0; i < 5; i++) {
    int timer = 0;
    while (timer < p[i]) {
      timer = timer + 10;
    }
    differential[i] = timer - p[i];
    if (max_differential < differential[i]) {
      max_differential = p[i];
    }
  }
  duty = max_differential;
  cout << "代入" << duty << endl;
  int add = 0;
  for (int i = 1; i < 11; i++) {
    if (duty % 10 != 0) {
      duty = duty + i;
    } else {
      break;
    }
  }
  sum = differential[0] + p[0] + differential[1] + p[1] + differential[2] +
        p[2] + differential[3] + p[3] + differential[4] + p[4] +
        max_differential - duty;
  cout << sum << endl;
  cout << duty << endl;
  return 0;
}
