#include <bits/stdc++.h>
using namespace std;
int main() {
  int minute[5], max_rem_val = 0, max_rem = 0, ans = 0;
  for (long long int i = (long long int)(0); i < (long long int)(5); i++) {
    cin >> minute[i];
    if (minute[i] % 10 > max_rem_val) {
      max_rem_val = minute[i] % 10;
      max_rem = i;
    }
  }
  for (long long int i = (long long int)(0); i < (long long int)(5); i++) {
    if (i == max_rem || minute[i] % 10 == 0) {
      ans += minute[i];
    } else {
      ans += minute[i] + (10 - minute[i] % 10);
    }
  }
  cout << ans << endl;
  return 0;
}
