#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  int min = 10;
  for (int i(0); i < 5; i++) {
    if (min > a[i] % 10 && a[i] % 10 != 0) {
      min = a[i] % 10;
    }
  }
  cout << min << endl;
  int sum = 0;
  for (int i(0); i < 5; i++) {
    if (a[i] % 10 != 0) {
      sum += a[i] + 10 - a[i] % 10;
    } else {
      sum += a[i];
    }
  }
  cout << sum << endl;
  cout << sum - (10 - min);
  return 0;
}
