#include <bits/stdc++.h>
using namespace std;
vector<long long> ok;
vector<long long> nok;
void doit() {
  long long n, d, m;
  cin >> n >> d >> m;
  vector<long long> v;
  long long x;
  while (n--) {
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(), v.end());
  long long mleg = 0;
  long long ans = 0;
  long long cur = 0;
  while ((mleg < v.size()) && (v[mleg] <= m)) {
    cur += v[mleg];
    mleg++;
  }
  long long sum[mleg];
  sum[0] = v[0];
  for (int i = 1; i < mleg; i++) {
    sum[i] = v[i] + sum[i - 1];
  }
  ans = cur;
  x = 1;
  long long comp = 0;
  while (v.size() - x >= mleg) {
    long long ci = v.size() - x;
    comp += v[ci];
    long long nesesito = max(((x - 1) * d) - (ci - mleg), (long long)(0));
    if (nesesito <= mleg) {
      long long mres = 0;
      if (nesesito)
        mres = comp + (cur - sum[nesesito - 1]);
      else
        mres = comp + cur;
      ans = max(mres, ans);
    }
    x++;
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  while (t--) {
    doit();
  }
}
