#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chMax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chMin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  vector<pair<int, int>> ryouri;
  vector<int> firstRyouri;
  for (long long i = 0; i < 5; i++) {
    int temp;
    cin >> temp;
    if (temp % 10 == 0) {
      firstRyouri.push_back(temp);
    } else {
      ryouri.push_back(make_pair(temp % 10, temp));
    }
  }
  if (ryouri.size() != 0) {
    sort(begin(ryouri), end(ryouri), greater<pair<int, int>>());
  }
  int sum = 0;
  sum = accumulate(begin(firstRyouri), end(firstRyouri), 0);
  for (long long i = 0; i < ryouri.size() - 1; i++) {
    sum += ryouri[i].second;
    sum += (10 - ryouri[i].first);
  }
  sum += ryouri[ryouri.size() - 1].second;
  cout << sum << endl;
  return 0;
}
