#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f;
long long sum[100010], sum2[100010];
vector<long long> a, b;
bool cmp(long long x, long long y) { return x > y; }
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long nn, n, m;
  cin >> nn >> n >> m;
  for (long long i = 1; i <= nn; i++) {
    long long t;
    cin >> t;
    if (t > m)
      b.push_back(t);
    else
      a.push_back(t);
  }
  sort(a.begin(), a.end(), cmp);
  sort(b.begin(), b.end(), cmp);
  sum[0] = 0, sum2[0] = 0;
  long long cnt = b.size(), cnt2 = a.size();
  for (long long i = 1; i <= cnt; i++) {
    sum[i] = sum[i - 1] + b[i - 1];
  }
  for (long long i = 1; i <= nn; i++) {
    if (i - 1 < cnt2)
      sum2[i] = sum2[i - 1] + a[i - 1];
    else
      sum2[i] = sum2[i - 1];
  }
  long long ans = sum2[nn];
  for (long long i = 1; i <= cnt; i++) {
    long long res = (i - 1) * (n + 1) + 1;
    if (res <= nn) ans = max(ans, sum[i] + sum2[nn - res]);
  }
  cout << ans << endl;
  return 0;
}
