#include <bits/stdc++.h>
using namespace std;
int sum(int data[], int n) {
  int total = 0;
  for (int i = 0; i < n; i++) {
    if (data[i] % 10 == 0) {
      total += data[i];
    } else {
      total += (data[i] - (data[i] % 10) + 10);
    }
  }
  return total;
}
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int array[5] = {A, B, C, D, E};
  int Max = 0;
  for (int j = 0; j < 5; j++) {
    if (Max < 10 - array[j] % 10) {
      Max = 10 - array[j] % 10;
    }
  }
  cout << sum(array, 5) - Max << endl;
}
