#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool sort_by_second(pair<int, int> a, pair<int, int> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}
int main() {
  vector<pair<int, int>> t;
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    int a;
    cin >> a;
    int b = a % 10;
    if (b == 0)
      sum += a;
    else
      t.push_back(make_pair(a, b));
  }
  sort(t.begin(), t.end(), sort_by_second);
  sum += t[0].first;
  for (int i = 1; i < t.size(); i++) sum += t[i].first - t[i].second + 10;
  cout << sum << endl;
}
