#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> A(5);
  for (int i = 0; i < A.size(); i++) {
    cin >> A.at(i);
  }
  vector<int> B(5);
  for (int i = 0; i < B.size(); i++) {
    int b, bb;
    bb = A.at(i) % 10;
    if (bb != 0) B.at(i) = bb;
  }
  sort(B.begin(), B.end());
  int sum = 0;
  for (int i = 0; i < A.size(); i++) {
    if (A.at(i) % 10 == 0)
      sum += A.at(i);
    else
      sum += A.at(i) - A.at(i) % 10 + 10;
  }
  if (B.size() != 0)
    cout << sum - 10 + B.at(0) << endl;
  else
    cout << sum << endl;
}
