#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  cin >> e;
  vector<int> time = {a, b, c, d, e};
  vector<int> next_time(5);
  for (int i = 0; i < (int)(5); i++) {
    next_time[i] = (time[i] + 9) / 10 * 10;
  }
  int best_time = INT_MAX;
  for (int i = 0; i < (int)(5); i++) {
    int sum_time = 0;
    for (int j = 0; j < (int)(5); j++) {
      if (i == j) {
        sum_time += time[j];
      } else {
        sum_time += next_time[j];
      }
      best_time = min(best_time, sum_time);
    }
  }
  cout << best_time << endl;
}
