#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> time(5);
  for (int i = 0; i < 5; i++) {
    cin >> time.at(i);
  }
  vector<int> next(5);
  for (int i = 0; i < 5; i++) {
    next.at(i) = (time.at(i) + 9) / 10 * 10;
  }
  int min_time = 999999999;
  for (int i = 0; i < 5; i++) {
    int sum_time = 0;
    for (int j = 0; j < 5; i++) {
      if (i == j) {
        sum_time += time.at(j);
      } else {
        sum_time += next.at(j);
      }
    }
    min_time = min(min_time, sum_time);
  }
  cout << min_time << endl;
}
