#include <bits/stdc++.h>
using namespace std;
const int inf = 1012345678;
int main() {
  vector<int> time(5);
  cin >> time[0] >> time[1] >> time[2] >> time[3] >> time[4];
  vector<int> P = {0, 1, 2, 3, 4};
  int best_time = inf;
  do {
    int sum_time = 0;
    for (int i = 0; i < 5; ++i) {
      if (time[P[i]] % 10 == 0) {
        sum_time += time[P[i]];
      } else {
        if (i == 5) {
          sum_time += time[P[i]];
        } else {
          sum_time += time[P[i]] - (time[P[i]] % 10) + 10;
        }
      }
    }
    best_time = min(best_time, sum_time);
  } while (next_permutation(P.begin(), P.end()));
  cout << best_time << "\n";
  return 0;
}
