#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  vector<int> a(5);
  int m = 9;
  for (int i = 0; i < 5; i++) {
    cin >> a.at(i);
    if (a.at(i) % 10 != 0) {
      m = min(m, a.at(i) % 10);
    }
  }
  int total = 0;
  for (int i = 0; i < 5; i++) {
    total += (a.at(i) % 10 == 0 ? a.at(i) : (a.at(i) / 10) * 10 + 10);
  }
  total += m - 10;
  cout << total << endl;
  return 0;
}
