#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> ryouri(5, 0);
  vector<int> tdiff(5, 0);
  for (int i = 0; i < ryouri.size(); i++) {
    cin >> ryouri.at(i);
    tdiff.at(i) = ryouri.at(i) % 10;
  }
  sort(tdiff.begin(), tdiff.end());
  int mark = 0;
  for (int i = 0; i < 5; i++) {
    if (tdiff.at(i) == 0) {
      continue;
    }
    if (tdiff.at(i) != 0) {
      mark = i;
      break;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (i != mark && ryouri.at(i) % 10 != 0) {
      ans += (ryouri.at(i) / 10 + 1) * 10;
    } else if (ryouri.at(i) % 10 == 0) {
      ans += ryouri.at(i);
    } else {
      ans += ryouri.at(i);
    }
  }
  cout << ans << endl;
}
