#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 5;
long long big[MAXN], small[MAXN], sum[MAXN];
long long p1 = 1, p2 = 1;
long long n, m, k, x;
signed main() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> x;
    if (x <= k) {
      small[p1++] = x;
    } else {
      big[p2++] = x;
    }
  }
  sort(small + 1, small + 1 + p1, greater<long long>());
  sort(big + 1, big + 1 + p2, greater<long long>());
  for (long long i = 1; i <= p1; i++) {
    sum[i] = sum[i - 1] + small[i];
  }
  long long ans = sum[p1], cur = 0;
  for (long long i = 1; i <= p2; i++) {
    cur += big[i];
    long long days = (i - 1) * (m + 1) + 1;
    if (days > n) {
      break;
    }
    long long left = min(n - days, p1);
    ans = max(ans, sum[left] + cur);
  }
  cout << ans << endl;
}
