#include <bits/stdc++.h>   using namespace std;   void dbg() { std::cout <<    # n ; }   template <typename T, typename... Args>   void dbg(T a, Args... args) {     std::cout << a <<    ;     dbg(args...);   }   const long long maxn = 2e5 + 10;   const long long MAX = 1000;   const long long inf = 0x3f3f3f3f;   const long long mod = 1e9 + 7;   long long n, d, m;   long long a[maxn];   long long b[maxn];   multiset<long long> small;   void solve() {     cin >> n >> d >> m;     for (long long i = (1); i <= (n); ++i) {       cin >> a[i];     }     sort(a + 1, a + 1 + n);     long long pos = upper_bound(a + 1, a + 1 + n, m) - a;     long long cans = 0;     long long ans = 0;     for (long long i = (1); i <= (pos - 1); ++i) small.insert(a[i]), cans += a[i];     long long forsmall = n - 1;     ans = max(cans, ans);     for (long long i = (1); i <= (n - pos + 1); ++i) {       if (forsmall < 0) break;       while (small.size() > forsmall) {         cans -= *small.begin();         small.erase(small.begin());       }       cans += a[n - i + 1];       ans = max(ans, cans);       forsmall -= (d + 1);     }     cout << (ans) << endl;   }   signed main() {     long long TestCase = 1;     while (TestCase--) {       solve();     }     char EndFile = getchar();     EndFile = getchar();     return 0;   }   