#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
int main() {
  vector<int> X(5);
  for (int i = 0; i < (5); i++) cin >> X.at(i);
  int sum = 0;
  for (int i = 0; i < (5); i++) {
    sum += (X.at(i) % 10 == 0) ? X.at(i) : (X.at(i) / 10 + 1) * 10;
  }
  int minL = MOD;
  for (int i = 0; i < (5); i++) {
    if (X.at(i) % 10 != 0) {
      minL = min(minL, X.at(i) % 10);
    }
  }
  int ans = sum - (10 - minL);
  cout << ans << endl;
  return 0;
}
