#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
long long n, d, m, ans, VAL;
long long a[N], par[N];
vector<long long> v1, v2;
void solve();
int32_t main() {
  cin >> n >> d >> m;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] <= m) {
      ans += a[i];
      VAL += a[i];
      v1.push_back(a[i]);
    } else
      v2.push_back(a[i]);
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  reverse(v2.begin(), v2.end());
  long long sz = v1.size();
  for (long long i = 1; i <= sz; i++) par[i] = par[i - 1] + v1[i - 1];
  long long val1 = 0;
  for (long long num = 1; num <= v2.size(); num++) {
    long long tedad = (num - 1) * d + num;
    if (tedad > n) continue;
    val1 += v2[num - 1];
    tedad = (num - 1) * d;
    long long val2 = val1;
    tedad -= (v2.size() - num);
    if (tedad >= 0) val2 -= par[tedad];
    ans = max(ans, val2 + VAL);
  }
  cout << ans;
  return 0;
}
