#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 pre_total = 0;
  for (int i = 0; i < 5; i++) {
    pre_total += dishes.at(i) / 10 * 10 + 10;
  }
  vector<int> remainers(5);
  for (int i = 0; i < 5; i++) {
    remainers.at(i) = dishes.at(i) % 10;
  }
  int A = 9;
  for (int i = 0; i < 5; i++) {
    if (remainers.at(i) != 0 && remainers.at(i) < A) {
      A = remainers.at(i);
    }
  }
  int B = 0;
  for (int i = 0; i < 5; i++) {
    if (remainers.at(i) == 0) {
      B++;
    }
  }
  cout << pre_total + A - 10 - B * 10 << endl;
}
