#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> times(5);
  int min_mod = 9;
  int min_mod_index;
  for (int i = 0; i < 5; i++) {
    int time;
    cin >> time;
    times.at(i) = time;
    int mod = time % 10;
    if (mod > 0 && mod < min_mod) {
      min_mod = mod;
      min_mod_index = i;
    }
  }
  int total = 0;
  for (int i = 0; i < 5; i++) {
    if (min_mod_index == i) {
      total += times.at(i);
    } else {
      total += ((times.at(i) + 9) / 10) * 10;
    }
  }
  cout << total << endl;
}
