#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> p(5);
  vector<int> r(5);
  for (int i = 0; i < 5; i++) {
    cin >> p[i];
    r[i] = p[i] % 10;
    if (r[i] == 0) {
      r[i] = 10;
      p[i] -= 10;
    }
  }
  int count = 0;
  for (int i = 0; i < 5; i++) {
    count += (p[i] / 10) + 10;
  }
  sort(r.begin(), r.end());
  count -= 10 - r[0];
  cout << count << endl;
}
