#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;
void Main() {
  vi a(5);
  int tot = 0;
  multiset<int> r;
  for (int(i) = 0; (i) < (5); (i)++) {
    cin >> a[i];
    if (a[i] % 10 != 0) r.insert(10 - a[i] % 10);
    a[i] = (a[i] + 9) / 10;
    a[i] *= 10;
    tot += a[i];
  }
  cout << tot - *r.rbegin() << endl;
  return;
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}
