#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 100;
const int mod = 1e9 + 7;
const int lg = 20;
const long long int inf = 1e16;
long long int p[N];
vector<long long int> x, y;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long int n, d, m;
  cin >> n >> d >> m;
  for (int i = 0; i < n; i++) {
    long long int a;
    cin >> a;
    if (a > m)
      x.push_back(a);
    else
      y.push_back(a);
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  reverse(x.begin(), x.end());
  reverse(y.begin(), y.end());
  long long int sz = x.size(), sy = y.size();
  for (int i = 1; i <= sy; i++) p[i] = p[i - 1] + y[i - 1];
  long long int sum = 0, ans = p[sy];
  for (int i = 0; i < x.size(); i++) {
    sum += x[i];
    long long int k = n - (i + 1) - i * d;
    if (k >= 0 && k - d <= sy) {
      ans = max(ans, sum + p[min(k, sy)]);
    }
  }
  cout << ans << endl;
  return 0;
}
