#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<int, int> > v;
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    int x;
    cin >> x;
    if (x % 10 == 0) {
      sum += x;
    } else {
      v.push_back(make_pair(x % 10, x));
    }
  }
  sort(v.begin(), v.end());
  sum += v[0].second;
  for (int i = 1; i < v.size(); i++) {
    sum += round(v[i].second / 10.0) * 10;
  }
  cout << sum;
  return 0;
}
