#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int main() {
  vector<int> dishes(5);
  for (int i = 0; i < (5); i++) cin >> dishes.at(i);
  vector<int> notpit;
  for (int i = 0; i < (5); i++) {
    if (dishes.at(i) % 10 != 0) {
      notpit.push_back(10 - (dishes.at(i) % 10));
    }
  }
  sort(notpit.begin(), notpit.end());
  int time = 0;
  sort(dishes.begin(), dishes.end());
  for (int i = 0; i < (5); i++) time += dishes.at(i);
  for (int i = 0; i < (notpit.size() - 1); i++) time += notpit.at(i);
  cout << time << endl;
}
