#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 ans = 0;
  for (int i = 0; i < 5; i++) {
    if (tdiff.at(4) == ryouri.at(i) % 10) {
      if (ryouri.at(i) % 10 == 0) {
        ans += ryouri.at(i);
      } else {
        ans += (ryouri.at(i) / 10 + 1) * 10;
      }
    }
  }
  for (int i = 0; i < 5; i++) {
    if (tdiff.at(3) == ryouri.at(i) % 10) {
      if (ryouri.at(i) % 10 == 0) {
        ans += ryouri.at(i);
      } else {
        ans += (ryouri.at(i) / 10 + 1) * 10;
      }
    }
  }
  for (int i = 0; i < 5; i++) {
    if (tdiff.at(2) == ryouri.at(i) % 10) {
      if (ryouri.at(i) % 10 == 0) {
        ans += ryouri.at(i);
      } else {
        ans += (ryouri.at(i) / 10 + 1) * 10;
      }
    }
  }
  for (int i = 0; i < 5; i++) {
    if (tdiff.at(1) == ryouri.at(i) % 10) {
      if (ryouri.at(i) % 10 == 0) {
        ans += ryouri.at(i);
      } else {
        ans += (ryouri.at(i) / 10 + 1) * 10;
      }
    }
  }
  for (int i = 0; i < 5; i++) {
    if (tdiff.at(0) == ryouri.at(i) % 10) {
      ans += ryouri.at(i);
    }
  }
  cout << ans << endl;
}
