#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> time(5), t(5);
  for (int i = 0; i < 5; i++) {
    cin >> time.at(i);
    t.at(i) = time.at(i) % 10;
  }
  sort(t.begin(), t.end());
  int end, num, sum = 0;
  for (int i = 4; i >= 0; i--) {
    for (int k = 0; k < 5; k++) {
      if (t.at(i) == time.at(k) % 10 && t.at(i) != 0) {
        end = time.at(k);
        num = k;
        break;
      }
    }
  }
  for (int i = 0; i < 5; i++) {
    if (time.at(i) % 10 != 0) {
      time.at(i) = ((time.at(i) / 10) + 1) * 10;
    }
    sum += time.at(i);
  }
  cout << sum - time.at(num) + end << endl;
}
