#include <bits/stdc++.h>
using namespace std;
char _;
long long i, j, k, a, b, c, d, f, g, h, l, m, n, p, q, r, s, t, u, v, w, x, y,
    z, maxx = INT_MIN, minn = INT_MAX, ans = 0, sum = 0, cnt = 0;
double e;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long A[10], B[10];
  for (int i = 0; i < 5; i++) {
    cin >> B[i];
  }
  sort(B, B + 5);
  for (int i = 0; i < 5; i++) {
    A[i] = B[i] % 10;
    if (A[i] == 0) {
      A[i] = 1000;
    }
  }
  maxx = A[0];
  for (i = 0; i < 5; i++) {
    if (A[i] < maxx) {
      maxx = A[i];
    }
  }
  for (i = 0; i < 5; i++) {
    if (A[i] == maxx && A[i] != 1000) {
      cnt += B[i];
    } else {
      e = (double)B[i] / 10.00;
      e = ceil(e);
      e *= 10.00;
      cnt += ((int)e);
    }
  }
  cout << cnt << endl;
  return 0;
}
