#include <bits/stdc++.h>   using namespace std;   const long long LLINF = 1e18;   const int INF = 1e9;   const int MOD = 20101009;   const int HMOD = 999959;   const int VMOD = 5000000;   const int MAXN = 1e5 + 10;   const int MAXM = 5e5 + 10;   const int INV = 10050505;   const long long LLINV = 1e18;   const double eps = 1e-3;   int dirx[5] = {0, -1, 1, 0, 0}, diry[5] = {0, 0, 0, -1, 1};   int n, d, m;   int cnt1, cnt2;   long long a[MAXN], b[MAXN];   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     scanf( %d%d%d , &n, &d, &m);     for (int i = 1, x; i <= n; ++i) {       scanf( %d , &x);       if (x <= m)         a[++cnt1] = x;       else         b[++cnt2] = x;     }     sort(a + 1, a + 1 + cnt1, greater<int>());     sort(b + 1, b + 1 + cnt2, greater<int>());     if (cnt2 == 0) {       long long sum = 0;       for (int i = 1; i <= n; ++i) sum += a[i];       printf( %lld n , sum);       return 0;     }     for (int i = 1; i <= cnt1; ++i) a[i] = a[i - 1] + a[i];     for (int i = 1; i <= cnt2; ++i) b[i] = b[i - 1] + b[i];     long long ans = 0;     for (int i = 1; i <= cnt2; ++i) {       long long tmp = (long long)(i - 1) * d;       long long oth = n - i;       long long ned = cnt1 - (max(0LL, tmp - (cnt2 - i)));       if (oth >= tmp) ans = max(ans, b[i] + a[ned]);     }     printf( %lld n , ans);     return 0;   }   