#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
void _yn(bool p) {
  p ? cout << "Yes"
           << "\n"
    : cout << "No"
           << "\n";
}
void _YN(bool p) {
  p ? cout << "YES"
           << "\n"
    : cout << "NO"
           << "\n";
}
LL gcd(LL a, LL b) {
  LL r;
  while ((r = a % b) != 0) {
    a = b;
    b = r;
  }
  return b;
}
LL lcm(LL a, LL b) { return (a / gcd(a, b) * b); }
bool is_prime(LL n) {
  for (LL i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
LL factorial(LL n) {
  LL a = 1, ret = 1;
  while (a < n) {
    a++;
    ret *= a;
    ret %= 1000000007;
  }
  return ret;
}
signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  LL a[5], A[5];
  LL m = 10;
  LL memo;
  for (LL i = 0; i < 5; i++) {
    cin >> a[i];
    A[i] = a[i] % 10;
    if (A[i] != 0) {
      m = min(m, A[i]);
      if (min(m, A[i]) == A[i]) {
        memo = a[i];
      }
    }
  }
  LL ans = 0;
  bool f = true;
  for (LL i = 0; i < 5; i++) {
    if (!f || (memo != a[i] && A[i] != 0)) {
      if (log10(a[i]) == 0) {
        a[i] = 0;
        a[i] += 10;
        f = false;
      } else {
        a[i] -= A[i];
        a[i] += 10;
      }
    }
    f = false;
  }
  for (LL i = 0; i < 5; i++) {
    ans += a[i];
  }
  cout << ans;
  return 0;
}
