#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long base = 998244353;
const long long oo = 1e6 + 10;
const long long gh = 1e3 + 3;
const long long inf = 1e15 + 5;
double pi = 2 * asin(1);
long long n, m, k;
long long a[oo];
long long ok[oo];
long long a1[oo], a2[oo];
long long sum[oo];
string s;
char c[oo];
void print() {}
void proc() {}
void Main() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  long long d = 0;
  long long tot = 0;
  queue<long long> q2;
  stack<long long> q1;
  long long fl = 2;
  for (long long i = n; i >= 1; i--) {
    if (a[i] > k) {
      if (fl == 2 || fl == 0) tot += a[i], d += (m + 1), q1.push(a[i]), fl = 0;
    }
    ok[i] = 1;
    if (d >= n && fl == 0) {
      break;
    }
  }
  if (fl == 0) d -= m;
  for (long long i = n; i >= 1; i--) {
    if (d >= n) break;
    if (a[i] <= k) {
      tot += a[i], d += 1;
    }
    ok[i] = 1;
    if (d >= n) break;
  }
  for (long long i = n; i >= 1; i--) {
    if (ok[i] == 0 && a[i] <= k) q2.push(a[i]);
  }
  while (q2.size()) {
    long long t = m + 1;
    long long sum = 0;
    while (q2.size() && (t--)) {
      sum += q2.front();
      q2.pop();
    }
    if (q1.size() > 1) {
      if (q1.top() < sum)
        tot -= q1.top(), tot += sum, q1.pop();
      else
        break;
    }
  }
  cout << tot;
}
int32_t main() {
  if (ifstream("test.txt")) {
    freopen("test.txt", "r", stdin);
  } else if (ifstream(""
                      ".inp")) {
    freopen(
        ""
        ".inp",
        "r", stdin);
    freopen(
        ""
        ".out",
        "w", stdout);
  }
  long long t = 1;
  while (t--) {
    Main();
  }
}
