#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int digit(int n) {
  int a = n % 10;
  return a;
}
int main() {
  int last = 10;
  int index = 0;
  vector<int> vec(5);
  ;
  for (int i = 0; i < (int)(5); i++) {
    cin >> vec[i];
  };
  for (int i = 0; i < (int)(5); i++) {
    int num = digit(vec[i]);
    cout << num << endl;
    if (num < last && num != 0) {
      last = digit(vec[i]);
      index = i;
    }
  }
  int sum = 0;
  ;
  for (int i = 0; i < (int)(5); i++) {
    int num = digit(vec[i]);
    if (i == index) {
      sum += vec[i];
    } else {
      if (num != 0) {
        sum += vec[i] + 10 - num;
      } else {
        sum += vec[i];
      }
    }
  }
  cout << sum << endl;
}
