#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAX = 1000000;
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % 1000000007) % 1000000007;
}
ll gcd(ll a, ll b) {
  ll r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}
template <class T>
struct cord {
  T x, y;
};
template <class T>
double dist(cord<T> a, cord<T> b) {
  T dx = a.x - b.x;
  T dy = a.y - b.y;
  return sqrt(dx * dx + dy * dy);
}
struct s {
  int p, i, r;
};
bool cmpP(const s &a, const s &b) { return a.p > b.p; }
bool cmpI(const s &a, const s &b) { return a.i < b.i; }
int main() {
  int n = 5;
  vector<int> q(n);
  for (int i = 0; i < n; i++) {
    cin >> q[i];
  }
  vector<int> q1(n);
  for (int i = 0; i < n; i++) {
    q1[i] = q[i] % 10;
  }
  vector<int> ot(n);
  for (int i = 0; i < n; i++) {
    ot[i] = q[i] / 10 * 10 + 10;
  }
  int M1i = 0, M1 = 0;
  for (int i = 0; i < n; i++) {
    if (M1 < q1[i]) {
      M1 = q1[i];
      M1i = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i == M1i) {
      ans += q[i];
    } else {
      ans += ot[i];
    }
  }
  cout << ans << endl;
  return 0;
}
