#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  vector<ll> v = {a, b, c, d, e};
  int sum = 0;
  bool f = false;
  for (int i = 0; i < 5; i++) {
    if (v[i] % 10 == 0)
      sum += v[i];
    else {
      sum += ((v[i] + 10) / 10) * 10;
      f = true;
    }
  }
  if (f) sum -= 10;
  ll m = 1001001;
  for (int i = 0; i < 5; i++) {
    if (v[i] % 10 != 0) {
      m = min(m, v[i] % 10);
    }
  }
  sum += m;
  cout << sum << endl;
}
