#include <bits/stdc++.h>
using namespace std;
template <typename T>
T &chmin(T &a, const T &b) {
  return a = min(a, b);
}
template <typename T>
T &chmax(T &a, const T &b) {
  return a = max(a, b);
}
const long long INF = 1e+18;
const double EPS = 1e-9;
const long long MOD = 1000000007;
const long long dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
signed main() {
  long long a[5], ans = 0, mi = 10;
  for (long long i = 0; i < 5; i++) cin >> a[i];
  for (long long i = 0; i < 5; i++) {
    mi = min(mi, a[i] % 10);
    if (a[i] % 10)
      ans += 10 * ((a[i] / 10) + 1);
    else
      ans += a[i];
  }
  if (mi == 0)
    cout << ans << endl;
  else
    cout << ans - 10 + mi << endl;
  return 0;
}
