#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  vector<int> dish(5);
  for (ll i = 0; i < (ll)(5); i++) {
    cin >> dish.at(i);
  }
  vector<int> v(5);
  iota(v.begin(), v.end(), 0);
  int cost = 124 * 5;
  do {
    vector<int> i;
    for (auto x : v) {
      i.push_back(x);
    }
    int time = 0;
    for (int j = 0; j < 4; j++) {
      time += (dish[i[j]] + 9) / 10 * 10;
    }
    time += dish[i[4]];
    cost = min(cost, time);
  } while (next_permutation(v.begin(), v.end()));
  cout << cost << endl;
}
