#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const long long int LINF = 1LL * INF * INF;
const int MAXN = 2e5 + 10;
const int MAXM = 5e3 + 10;
priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;
int A[MAXN];
long long int psum[MAXN];
char S[MAXN];
vector<int> big;
vector<int> small;
int main() {
  int n, m, k, a, b, x, y, q;
  int sum = 0;
  int cnt = 0;
  int mx = 0;
  int mn = INF;
  int cur = 0, idx = -1;
  int tc;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  m++;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x <= k)
      small.push_back(x);
    else
      big.push_back(x);
  }
  sort(small.begin(), small.end(), greater<int>());
  sort(big.begin(), big.end(), greater<int>());
  for (int i = 0; i < (int)small.size(); i++) {
    psum[i + 1] = psum[i] + (long long int)small[i];
  }
  int sz = (int)small.size();
  int bsz = (int)big.size();
  long long int res = psum[sz];
  long long int curv;
  long long int vv = 0;
  for (int i = 0; i < (int)big.size(); i++) {
    if (!i)
      sum = 1;
    else
      sum += m;
    if (sum > n) break;
    vv += (long long int)big[i];
    if (bsz > sum) {
      curv = vv + psum[sz];
      res = max(res, curv);
    } else {
      curv = vv + psum[min(sz, n - sum)];
      res = max(res, curv);
    }
  }
  cout << res << "\n";
  return 0;
}
