#include <bits/stdc++.h>
using namespace std;
mt19937 Rand(time(0));
const int maxn = 1e5 + 5;
const long long maxc = 1e9 + 7;
int n, m, d, a[maxn];
long long sum[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> d >> m;
  for (int i = (1); i <= (n); ++i) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (int i = (1); i <= (n); ++i) sum[i] = sum[i - 1] + a[i];
  if (a[n] <= m) return cout << sum[n], 0;
  int id = upper_bound(a + 1, a + n + 1, m) - a;
  long long res = a[n] + sum[id - 1];
  long long ans = res;
  for (int i = (n - 1); i >= (id); --i) {
    if (1LL * (n - i) * d > n) continue;
    int r = (n - i) * d;
    if (r - (i - id) < id) {
      ans = max(ans, res + sum[n - 1] - sum[i - 1] - sum[max(0, r - (i - id))]);
    }
  }
  cout << ans;
  return 0;
}
