#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> A(5);
  int min_num = 130;
  int min_ind;
  for (int i = 0; i < 5; i++) {
    cin >> A.at(i);
    if (min_num > A.at(i) % 10 && A.at(i) % 10 != 0) {
      min_num = A.at(i) % 10;
      min_ind = i;
    }
  }
  int time = 0;
  for (int i = 0; i < 5; i++) {
    if (i != min_ind) time += 10 * (A.at(i) / 10) + 10;
  }
  time += A.at(min_ind);
  cout << time << endl;
}
