#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> dish_time(5);
  int min_time = 9;
  int pos = 0;
  for (int i = 0; i < 5; ++i) {
    cin >> dish_time.at(i);
    if (min_time % 10 >= dish_time.at(i) % 10 && dish_time.at(i) % 10 != 0) {
      min_time = dish_time.at(i);
      pos = i;
    }
  }
  int sum = 0;
  for (int i = 0; i < 5; ++i) {
    if (i == pos) {
      sum += min_time;
    } else {
      if (dish_time.at(i) % 10 == 0) {
        sum += dish_time.at(i);
      } else {
        sum += (dish_time.at(i) - (dish_time.at(i) % 10) + 10);
      }
    }
  }
  cout << sum << endl;
  return 0;
}
