#include <bits/stdc++.h>
using namespace std;
long long int n;
bool cmp(pair<pair<long long int, long long int>,
              pair<long long int, long long int> >
             p1,
         pair<pair<long long int, long long int>,
              pair<long long int, long long int> >
             p2) {
  if (p1.first.first < p2.first.first) return true;
  if (p1.first.first > p2.first.first) return false;
  if (p1.first.second < p2.first.second) return true;
  if (p1.first.second > p2.first.second) return false;
  long long int v1 = min(n - 1 - p1.second.second, p1.second.second);
  long long int v2 = min(n - 1 - p2.second.second, p2.second.second);
  if (v1 < v2)
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, d, m;
  cin >> n >> d >> m;
  vector<long long int> vals;
  vector<long long int> larger;
  vector<long long int> smaller;
  for (int i = 1; i <= n; i++) {
    long long int x;
    cin >> x;
    if (x <= m) smaller.push_back(x);
    if (x > m) larger.push_back(x);
  }
  vector<long long int> csum1;
  vector<long long int> csum2;
  sort(smaller.begin(), smaller.end());
  sort(larger.rbegin(), larger.rend());
  if (larger.size() == 0) {
    long long int fans = 0;
    for (int i = 0; i < smaller.size(); i++) {
      fans += smaller[i];
    }
    cout << fans << endl;
    return 0;
  }
  if (smaller.size() == 0) {
    csum2.push_back(larger[0]);
    for (int i = 1; i < larger.size(); i++) {
      csum2.push_back(larger[i] + csum2[i - 1]);
    }
    long long int ans = 0;
    for (int i = 1; i <= csum2.size(); i++) {
      long long int cans = csum2[i - 1];
      long long int lrg_lft = csum2.size() - i;
      long long int req = d * (i - 1);
      long long int rem = req - lrg_lft;
      if (rem <= 0)
        ans = cans;
      else
        break;
    }
    cout << ans << endl;
    return 0;
  }
  csum1.push_back(smaller[0]);
  for (int i = 1; i < smaller.size(); i++) {
    csum1.push_back(smaller[i] + csum1[i - 1]);
  }
  csum2.push_back(larger[0]);
  for (int i = 1; i < larger.size(); i++) {
    csum2.push_back(larger[i] + csum2[i - 1]);
  }
  long long int ans = 0;
  for (int i = 1; i <= csum2.size(); i++) {
    long long int cans = csum2[i - 1];
    long long int lrg_lft = csum2.size() - i;
    long long int req = d * (i - 1);
    long long int rem = req - lrg_lft;
    if (rem <= 0) {
      cans += csum1[csum1.size() - 1];
      ans = max(cans, ans);
    } else {
      long long int extra = csum1.size();
      if (extra < rem) break;
      cans = cans + (csum1[csum1.size() - 1] - csum1[rem - 1]);
      ans = max(ans, cans);
    }
  }
  cout << ans << endl;
}
