#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
long long ar[maxn];
struct Node {
  long long l, r, sum;
  Node() { sum = 0; }
} dp[maxn];
int main() {
  int N, D, M;
  cin >> N >> D >> M;
  int l = 1, r = N;
  for (int i = 0; i < N; i++) {
    int num;
    scanf("%lld", &num);
    if (num <= M) {
      ar[l++] = num;
    } else {
      ar[r--] = num;
    }
  }
  sort(ar + 1, ar + l, greater<long long>());
  sort(ar + r + 1, ar + N + 1, greater<long long>());
  if (r < N) {
    dp[N].sum = ar[r + 1];
    dp[N].l = 1;
    dp[N].r = r + 2;
  } else {
    dp[N].sum = ar[1];
    dp[N].l = 2;
    dp[N].r = r + 1;
  }
  for (int i = N - 1; i >= 1; i--) {
    if ((dp[i + D + 1].sum + ar[dp[i + D + 1].r] >
         dp[i + 1].sum + ar[dp[i + 1].l]) ||
        dp[i + 1].l >= l) {
      dp[i].sum = dp[i + D + 1].sum + ar[dp[i + D + 1].r];
      dp[i].l = dp[i + D + 1].l;
      dp[i].r = dp[i + D + 1].r + 1;
    } else {
      dp[i].sum = dp[i + 1].sum + ar[dp[i + 1].l];
      dp[i].r = dp[i + 1].r;
      dp[i].l = dp[i + 1].l + 1;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= N; i++) {
    ans = max(ans, dp[i].sum);
  }
  cout << ans << endl;
  return 0;
}
