#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main() {
  vector<int> p;
  vector<P> q;
  ;
  for (ll i = 0; i < (ll)5; i++) {
    int c;
    cin >> c;
    if (c % 10 == 0)
      p.push_back(c);
    else
      q.push_back({c % 10, c});
  }
  sort(q.rbegin(), q.rend());
  int ans = 0;
  ;
  for (ll i = 0; i < (ll)p.size(); i++) ans += p[i];
  ;
  for (ll i = 0; i < (ll)q.size() - 1; i++)
    ans += 10 * ((q[i].second + 9) / 10);
  ans += q[q.size() - 1].second;
  cout << ans << endl;
}
