#include <bits/stdc++.h>
using namespace std;
long long n, m, k, te, ans;
long long p[100009], high[100009], low[100009];
bool cmp(long long a, long long b) { return a > b; }
int main() {
  long long cnt1 = 0, cnt2 = 0;
  scanf("%lld%lld%lld", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &p[i]);
    if (p[i] > k)
      high[++cnt1] = p[i];
    else
      low[++cnt2] = p[i];
  }
  sort(high + 1, high + cnt1 + 1, cmp);
  sort(low + 1, low + cnt2 + 1, cmp);
  for (int i = 2; i <= cnt2; i++) low[i] += low[i - 1];
  long long ans = low[cnt2], pos, res = 0;
  for (int i = 1; i <= cnt1; i++) {
    res += high[i];
    pos = (i - 1) * (m + 1) + 1;
    if (pos > n) break;
    pos = n - pos;
    pos = min(pos, cnt2);
    ans = max(ans, res + low[pos]);
  }
  printf("%lld\n", ans);
  return 0;
}
