#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = {0, -1, 1, 0};
const int dy[4] = {-1, 0, 0, 1};
const int INF = 1e9 + 7;
int gcd(int x, int y) {
  if (x < y) swap(x, y);
  if (y == 0) return x;
  return gcd(y, x % y);
}
template <class T1, class T2>
void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <class T1, class T2>
void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
template <class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) {
    val += mod;
  }
  a = val;
}
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  vector<pii> V(5);
  int A = (a % 10);
  int B = (b % 10);
  int C = (c % 10);
  int D = (d % 10);
  int E = (e % 10);
  V[0].first = A, V[0].second = a;
  V[1].first = B, V[1].second = b;
  V[2].first = C, V[2].second = c;
  V[3].first = D, V[3].second = d;
  V[4].first = E, V[4].second = e;
  sort(V.begin(), V.end());
  int ans = 0;
  int key = 6;
  for (int i = 0; i < 5; ++i) {
    if (V[i].first == 0) {
      ans += V[i].second;
    } else {
      key = i;
      break;
    }
  }
  if (key == 6) {
    return 0;
  } else {
    ans += V[key].second;
    for (int i = key + 1; i < 5; ++i) {
      V[i].second += (10 - (V[i].second % 10));
      ans += V[i].second;
    }
    cout << ans << endl;
  }
  return 0;
}
