#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 17;
long long cnt, ans, lnt, sum, n, l1, x, y, a[N];
pair<long long, long long> pr[N];
vector<long long> v, v2, v3;
map<long long, long long> mp;
bool used[N], t1, t2;
vector<string> sv;
int main() {
  for (long long i = 0; i < 5; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i < 5; i++) {
    if (a[i] % 10 != 0) {
      x = 10 - (a[i] % 10);
      if (x > n) {
        n = x;
      }
    }
  }
  for (long long i = 0; i < 5; i++) {
    if (a[i] % 10 == n) {
      sum += a[i];
      a[i] = 0;
      break;
    }
  }
  for (long long i = 0; i < 5; i++) {
    if (a[i] % 10 != 0) {
      a[i] += 10 - (a[i] % 10);
    }
  }
  for (long long i = 0; i < 5; i++) {
    sum += a[i];
  }
  cout << sum;
}
