#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void print(const T& rhs) {
  std::cout << " = " << rhs << std::endl;
}
template <typename T>
inline void print(const std::vector<T>& rhs) {
  std::cout << " = [ ";
  for (uint32_t i = 0; i < rhs.size(); ++i) {
    std::cout << rhs[i] << ' ';
  }
  std::cout << "]" << std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs) {
  std::cout << " = " << std::endl;
  std::cout << "[[ ";
  for (uint32_t p = 0; p < rhs.size(); ++p) {
    if (p != 0) {
      std::cout << " [ ";
    }
    for (uint32_t q = 0; q < rhs[p].size(); ++q) {
      std::cout << rhs[p][q] << ' ';
    }
    if (p != rhs.size() - 1) {
      std::cout << "]" << std::endl;
    }
  }
  std::cout << "]]" << std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR, TL>>& rhs) {
  std::cout << " = [";
  uint32_t i = 0;
  for (; i < rhs.size() - 1; ++i) {
    std::cout << "[f: " << rhs[i].first << ", s: " << rhs[i].second << "], ";
  }
  std::cout << "[f: " << rhs[i].first << ", s: " << rhs[i].second << "]]"
            << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  const uint32_t N = 5;
  vector<int> vT(N);
  for (uint32_t i = 0; i < N; ++i) {
    cin >> vT[i];
  }
  int sum = 0;
  int min_mod = INT_MAX;
  for (uint32_t i = 0; i < N; ++i) {
    int div = vT[i] / 10;
    int mod = vT[i] - 10 * div;
    if (mod != 0) {
      min_mod = min(min_mod, mod);
    }
    sum += 10 * div + (mod != 0 ? 10 : 0);
  }
  cout << sum - (10 - min_mod) << endl;
  return 0;
}
