#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v(5);
  for (int i = 0; i < 5; i++) cin >> v.at(i);
  int s = 0, m = 9;
  bool a = 1;
  for (int i = 0; i < 5; i++) {
    if (v.at(i) % 10 != 0) {
      m = min(m, v.at(i) % 10);
      v.at(i) = (v.at(i) / 10 + 1) * 10;
      a = 0;
    }
    s += v.at(i);
  }
  if (a) m = 0;
  cout << s - 10 + m << endl;
}
