#include <bits/stdc++.h>
using namespace std;
bool pair_comp(pair<long long, long long> &a, pair<long long, long long> &b) {
  return a.second > b.second;
}
int main() {
  vector<long long> v(5);
  for (long long i = 0; i < 5; ++i) {
    cin >> v[i];
  }
  long long ans = 0;
  vector<pair<long long, long long>> vt;
  for (long long i = 0; i < 5; ++i) {
    if (v[i] % 10 == 0) {
      ans += v[i];
    } else {
      long long tmp = v[i] - ((v[i] / 10) * 10);
      vt.push_back(pair<long long, long long>(i, tmp));
    }
  }
  sort(vt.begin(), vt.end(), pair_comp);
  for (long long i = 0; i < vt.size() - 1; ++i) {
    ans += v[vt[i].first] - vt[i].second + 10;
  }
  ans += v[vt[vt.size() - 1].first];
  cout << ans << endl;
  return 0;
}
