#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, d, m;
  cin >> n >> d >> m;
  vector<long long> a(n);
  vector<long long> b;
  vector<long long> pref_b = {0};
  long long sm = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i] <= m) {
      b.push_back(a[i]);
    }
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  sort(b.begin(), b.end());
  reverse(b.begin(), b.end());
  for (long long i = 0; i < b.size(); ++i) {
    pref_b.push_back(pref_b[i] + b[i]);
  }
  long long res = 0;
  long long l = 0;
  long long r = n - 1;
  vector<long long> pref_a = {0};
  sm = 0;
  while (r >= l) {
    if (a[l] <= m) {
      break;
    }
    sm += a[l];
    pref_a.push_back(sm);
    l++;
    r -= d;
  }
  for (long long i = 0; i <= l; ++i) {
    long long cur = pref_a[i];
    long long c = n - i - (i - 1) * d;
    c = min(c, (long long)b.size());
    cur += pref_b[c];
    res = max(res, cur);
  }
  cout << res;
}
