#include <bits/stdc++.h>
const double eps = 1e-8;
const long long INF = 1e18;
const double pie = acos(-1.0);
using namespace std;
long long fun[100005], mad[100005];
long long s1[100005], s2[100005];
long long ans;
bool cmp(int x, int y) { return x > y; }
int main() {
  long long n, d, m, a;
  long long l1 = 0, l2 = 0;
  cin >> n >> d >> m;
  for (long long i = (1); i <= (n); i++) {
    scanf("%lld", &a);
    if (a <= m)
      fun[++l1] = a;
    else
      mad[++l2] = a;
  }
  sort(fun + 1, fun + 1 + l1, cmp);
  sort(mad + 1, mad + 1 + l2, cmp);
  for (long long i = (1); i <= (l1); i++) s1[i] = s1[i - 1] + fun[i];
  for (long long i = (1); i <= (l2); i++) s2[i] = s2[i - 1] + mad[i];
  for (long long i = (0); i <= (l2); i++) {
    if (l1 + l2 - i < (i - 1) * d) continue;
    long long temp;
    long long res = min(l1, l1 + l2 - i - (i - 1) * d);
    temp = s1[res] + s2[i];
    ans = max(ans, temp);
  }
  cout << ans;
  return 0;
}
