#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> dishes(5);
  for (int i = 0; i < 5; i++) {
    cin >> dishes.at(i);
  }
  int fst = 9;
  int last = 0;
  int count = 0;
  for (int i = 0; i < 5; i++) {
    int r;
    r = dishes.at(i) % 10;
    if (r < fst) {
      fst = r;
      last = i;
    }
    if (r == 0) {
      count += dishes.at(i);
    } else {
      count += (dishes.at(i) / 10 + 1) * 10;
    }
  }
  cout << count - (10 - (dishes.at(last) % 10)) << endl;
}
