#include <bits/stdc++.h>
using namespace std;
vector<int> a;
int main() {
  int ans_sum = 10000;
  for (int i = 0; i < 5; i++) {
    int _in;
    cin >> _in;
    a.push_back(_in);
  }
  vector<int> P{0, 1, 2, 3, 4};
  do {
    int sum = 0;
    for (int i = 0; i < 5; i++) {
      if (i == 4) {
        sum += a[P[i]];
      } else {
        sum += a[P[i]] + 10 - (a[P[i]] % 10);
      }
    }
    ans_sum = min(ans_sum, sum);
  } while (next_permutation(P.begin(), P.end()));
  cout << ans_sum << endl;
  return 0;
}
