#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool amax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool amin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int32_t GCD(int32_t a, int32_t b) { return b ? GCD(b, a % b) : a; }
int64_t GCD(int64_t a, int64_t b) { return b ? GCD(b, a % b) : a; }
int32_t LCM(int32_t a, int32_t b) { return a * b / GCD(a, b); }
int64_t LCM(int64_t a, int64_t b) { return a * b / GCD(a, b); }
struct aaa {
  aaa() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} aaaaaaa;
constexpr int32_t INF = 1001001001;
constexpr int64_t LINF = 1001001001001001001ll;
constexpr int32_t MOD = 1e9 + 7;
constexpr int64_t EPS = 1e-9;
constexpr int32_t dx[] = {1, 1, 0, -1, -1, -1, 0, 1},
                  dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
signed main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  vector<int> z{a, b, c, d, e};
  int mi{9};
  for (int i = 0; i < 5; ++i) {
    if (z[i] % 10 != 0) {
      if (mi % 10 >= z[i] % 10) mi = z[i];
    }
  }
  int sum = mi;
  for (auto i : z) {
    if (i != mi) sum += (i + 9) / 10 * 10;
  }
  cout << sum << '\n';
}
