Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.

In Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.

Du will chat in the group for $n$ days. On the $i$-th day:  If Du can speak, he'll make fun of Boboniu with fun factor $a_i$. But after that, he may be muzzled depending on Boboniu's mood.  Otherwise, Du won't do anything. 

Boboniu's mood is a constant $m$. On the $i$-th day:  If Du can speak and $a_i>m$, then Boboniu will be angry and muzzle him for $d$ days, which means that Du won't be able to speak on the $i+1, i+2, \cdots, \min(i+d,n)$-th days.  Otherwise, Boboniu won't do anything. 

The total fun factor is the sum of the fun factors on the days when Du can speak.

Du asked you to find the maximum total fun factor among all possible permutations of $a$.


-----Input-----

The first line contains three integers $n$, $d$ and $m$ ($1\le d\le n\le 10^5,0\le m\le 10^9$).

The next line contains $n$ integers $a_1, a_2, \ldots,a_n$ ($0\le a_i\le 10^9$).


-----Output-----

Print one integer: the maximum total fun factor among all permutations of $a$.


-----Examples-----
Input
5 2 11
8 10 15 23 5

Output
48

Input
20 2 16
20 5 8 2 18 16 2 16 16 1 5 16 2 13 6 16 4 17 21 7

Output
195



-----Note-----

In the first example, you can set $a'=[15, 5, 8, 10, 23]$. Then Du's chatting record will be:  Make fun of Boboniu with fun factor $15$.  Be muzzled.  Be muzzled.  Make fun of Boboniu with fun factor $10$.  Make fun of Boboniu with fun factor $23$. 

Thus the total fun factor is $48$.

Difficulty: competition

Starter code:

Solutions:
import sys
readline = sys.stdin.readline

N, D, M = map(int, readline().split())
A = list(map(int, readline().split()))
Am = [a for a in A if a > M]
Ao = [a for a in A if a <= M]
Am.sort(reverse = True)
Ao.sort(reverse = True)
Cam = Am[:]
Cao = Ao[:]

for i in range(1, len(Cam)):
    Cam[i] += Cam[i-1]
for i in range(1, len(Cao)):
    Cao[i] += Cao[i-1]

k = -(-N//(D+1))
ans = sum(Am[:k])
lcam = len(Cam)
Cam = [0] + Cam
for i in range(len(Cao)):
    k = min(lcam, -(-(N-(i+1))//(D+1)))
    ans = max(ans, Cao[i] + Cam[k])


print(ans)

import sys

sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def solve():
    pre = []
    pos = []
    for a in aa:
        if a > m: pos.append(a)
        else: pre.append(a)
    pos.sort(reverse=True)
    pre.sort(reverse=True)

    cs = [0]
    for a in pre: cs.append(cs[-1] + a)
    pre = cs
    cs = [0]
    for a in pos: cs.append(cs[-1] + a)
    pos = cs

    ans = 0
    for i in range(len(pre)):
        j = min((n - i - 1) // (d + 1) + 1, len(pos) - 1)
        cur = pre[i] + pos[j]
        ans = max(ans, cur)

    print(ans)

n,d,m=MI()
aa=MI()
solve()


import sys
input = sys.stdin.readline

n, d, m = map(int, input().split())
a = list(map(int, input().split()))

up = []
down = []
for i in range(n):
    if a[i] > m:
        up.append(a[i])
    else:
        down.append(a[i])
        
up = sorted(up)
down = sorted(down)

if not up:
    print(sum(down))
    return

ans = 0
ans += up.pop()
lap, rem = divmod((n - 1), (d + 1))
for i in range(rem):
    if not down:
        break
    else:
        ans += down.pop()

matome = []
while down:
    tmp = 0
    for _ in range(d + 1):
        if down:
            tmp += down.pop()
    matome.append(tmp)

matome = sorted(matome + up, reverse=True)
ans += sum(matome[0:min(lap, len(matome))])

print(ans)


n, d, m = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a = list(reversed(sorted(a)))
nl = [x for x in a if x <= m]
ml = [x for x in a if x > m]
aml = [0]
for x in ml:
    aml.append(aml[-1] + x)
anl = [0]
for x in nl:
    anl.append(anl[-1] + x)

if len(ml) == 0:
    print(sum(nl))
    return

result = []

best = 0

for i in range(1, len(ml) + 1):
    # Is it possible to have i muzzles?
    if (i-1)*(d+1) + 1 > n:
        continue
    if i*d < len(ml) - i:
        continue

    # What is my score if I cause i muzzles?
    # Then it is: the top i muzzling elements.
    # Plus the top how many nmes I have left after filling

    cur = aml[i]
    need_nmes = max(0, (i-1)*(d+1) + 1 - len(ml))
    rem_nmes = len(nl) - need_nmes
    assert rem_nmes >= 0
    cur += anl[rem_nmes]
    
    if cur > best:
        #print("Doing better with", i, "muzzles:", cur)
        best = cur

print(best)


n, d, m = list(map(int, input().split()))
a = list(map(int, input().split()))
p = []
q = []
for x in a:
    if x > m:
        p.append(x)
    else:
        q.append(x)
p = [0] + sorted(p, reverse=True)
q = [0] + sorted(q, reverse=True)
for i in range(len(p) - 1):
    p[i + 1] += p[i]
for i in range(len(q) - 1):
    q[i + 1] += q[i]
ans = 0
for t in range(len(p)):
    v = n + d - t * d - t
    if 0 <= v < len(q) + d:
        ans = max(ans, p[t] + q[min(v, len(q) - 1)])
print(ans)


import sys
input = sys.stdin.readline

n,d,m=list(map(int,input().split()))
A=list(map(int,input().split()))

P=[]
M=[]

for a in A:
    if a>m:
        P.append(a)
    else:
        M.append(a)

P.sort(reverse=True)
M.sort(reverse=True)

if P==[]:
    print(sum(M))
    return

ANS=sum(M)+P[0]

useP=1
useM=len(M)
SUM=ANS

#print(ANS)

while 0<=useP<=len(P) and 0<=useM<=len(M):
    if n-(useP+useM+1)>=useP*d:
        useP+=1

        if useP>len(P):
            break
        
        SUM+=P[useP-1]

    else:
        if useM==0:
            break
        
        SUM-=M[useM-1]
        useM-=1

    #print(useP,useM,SUM)

    ANS=max(ANS,SUM)

print(ANS)