#include <bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main() {
  long long n, d, m;
  cin >> n >> d >> m;
  long long coun = 0;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  sort(arr + 1, arr + n + 1);
  for (long long i = 1; i <= n; i++) {
    if (arr[i] <= m) coun++;
    arr[i] += arr[i - 1];
  }
  long long maxi = arr[coun];
  for (long long i = n, j = 1; i >= 1 && j <= n - coun; j++, i -= d + 1) {
    maxi = max(maxi,
               arr[coun] - arr[max(0ll, coun - (i - 1))] + arr[n] - arr[n - j]);
  }
  cout << maxi;
  return 0;
}
