#include <bits/stdc++.h>
using namespace std;
long long dx[] = {1, -1, 0, 0};
long long dy[] = {0, 0, 1, -1};
template <class T>
inline void chmax(T &a, const T &b) {
  if (a < b) a = b;
}
template <class T>
inline void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast {
  Fast() {
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
long long solve() {
  long long a[5];
  long long res = 0;
  long long m = 1e18;
  for (long long i = (long long)(0); i < (long long)(5); ++i) {
    cin >> a[i];
    res += (a[i] / 10) * 10;
    if (a[i] % 10 > 0) {
      res += 10;
      chmin(m, a[i] % 10);
    }
  }
  42;
  cout << res - (10 - m) << endl;
  return 0;
}
signed main() {
  solve();
  return 0;
}
