#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  vector<int> a(5);
  vector<int> b(5);
  for (long long i = 0; i < 5; i++) {
    cin >> a[i];
    b[i] = a[i] % 10;
  }
  int res = 0;
  for (long long i = 0; i < 5; i++) {
    res += (a[i] + 9) / 10 * 10;
  }
  res -= 10 - *min_element((b).begin(), (b).end());
  cout << res << "\n";
  return 0;
}
