#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> g;
vector<int> ch;
vector<bool> vis1;
vector<int> par(1000000);
vector<int> sz(1000000);
void print(vector<long long> v) {
  vector<long long>::iterator it = v.begin();
  while (it != v.end()) {
    cout << *it << " ";
    it++;
  }
  cout << endl;
}
void create(int n) {
  for (int i = 1; i <= n; i++) {
    par[i] = i;
    sz[i] = 1;
  }
}
int fp(int n) {
  if (par[n] == n) return n;
  return par[n] = fp(par[n]);
}
void merg(int x, int y) {
  x = fp(x);
  y = fp(y);
  if (sz[x] < sz[y]) {
    swap(x, y);
  }
  par[y] = x;
  sz[x] += sz[y];
}
int main() {
  int n, d, m;
  cin >> n >> d >> m;
  vector<long long> v(n);
  vector<long long> gr;
  vector<long long> sm;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (v[i] <= m) {
      sm.push_back(v[i]);
      ans += v[i];
    } else {
      gr.push_back(v[i]);
    }
  }
  sort(sm.begin(), sm.end());
  reverse(sm.begin(), sm.end());
  sort(gr.begin(), gr.end());
  reverse(gr.begin(), gr.end());
  int smsz = sm.size();
  int grsz = gr.size();
  vector<long long> smsum(smsz + 1);
  smsum[0] = 0;
  for (int i = 1; i <= smsz; i++) {
    smsum[i] = smsum[i - 1] + sm[i - 1];
  }
  vector<long long> grsum(grsz + 1);
  grsum[0] = 0;
  for (int i = 1; i <= grsz; i++) {
    grsum[i] = grsum[i - 1] + gr[i - 1];
  }
  for (int b = 0; b < grsz; b++) {
    int used = (b * d) + b + 1;
    int unused = n - used;
    if (unused < 0) break;
    long long cur = grsum[b + 1];
    int x = min(smsz, unused);
    cur += smsum[x];
    ans = max(ans, cur);
  }
  cout << ans << endl;
}
