#include <bits/stdc++.h>
using namespace std;
template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}
int main() {
  vector<int> an(5);
  vector<int> a1(5);
  for (int i = 0; i <= 4; i++) {
    cin >> an[i];
    a1[i] = an[i] % 10;
    if (a1[i] == 0) {
      a1[i] = 10;
    }
  }
  int ans = 0, b = 0;
  decltype(a1)::iterator minf = min_element(a1.begin(), a1.end());
  for (int i = 0; i <= 4; i++) {
    if (a1[i] != *minf) {
      if (a1[i] == 10) {
        ans += (an[i] / 10) * 10;
      } else {
        ans += (an[i] / 10 + 1) * 10;
      }
    } else {
      b = an[i];
    }
  }
  cout << ans + b << endl;
}
