#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  vector<pair<long long, long long>> V;
  long long ans = 0;
  for (int i = 0; i < 5; i++) {
    long long x;
    cin >> x;
    if (x % 10 == 0)
      ans += x;
    else
      V.push_back(make_pair(x % 10, x));
  }
  sort(V.begin(), V.end());
  for (int i = V.size() - 1; i >= 1; i--) {
    long long x = V[i].second;
    if (x % 10 == 0)
      ans += x;
    else
      ans += (x / 10 + 1) * 10;
  }
  cout << ans + V[0].second << endl;
}
