#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> A(5);
  for (int i = 0; i < 5; i++) cin >> A[i];
  sort(A.begin(), A.end());
  int min_ = 10000000;
  do {
    int t = 0;
    for (int i = 0; i < 4; i++) {
      int m = A[i] % 10;
      if (m == 0)
        t += A[i];
      else
        t += A[i] + (10 - m);
    }
    t += A[4];
    min_ = min(min_, t);
  } while (next_permutation(A.begin(), A.end()));
  cout << min_ << endl;
  return 1;
}
