#include <bits/stdc++.h>
using namespace std;
int main() {
  int sum = 0;
  int last = 10;
  int t;
  for (int i = 0; i < 5; i++) {
    cin >> t;
    if (!t % 10) {
      sum += t;
      continue;
    }
    sum += (t / 10 + 1) * 10;
    last = last < t % 10 ? t % 10 : last;
  }
  cout << sum - 10 + last << endl;
  return 0;
}
