#include<bits/stdc++.h>
using namespace std;
long long dp[100001];
int a[100001];
int n,L,R;
long long DP(int i)
{
if (i>100000) return 0;
if (dp[i]!=-1) return dp[i];
return dp[i]=max(DP(i+1),DP(i+R+1)+a[i]);
}
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--)
{
memset(a,0,sizeof(a));
memset(dp,-1,sizeof(dp));
cin>>n>>L>>R;
R=min(L,R);
while(n--)
{
int x;
cin>>x;
a[x]+=x;
}
cout<<DP(0)<<endl;
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKbG9uZyBsb25nIGRwWzEwMDAwMV07CmludCBhWzEwMDAwMV07CmludCBuLEwsUjsKbG9uZyBsb25nIERQKGludCBpKQp7CiAgICBpZiAoaT4xMDAwMDApICByZXR1cm4gMDsKICAgIGlmIChkcFtpXSE9LTEpIHJldHVybiBkcFtpXTsKICAgIHJldHVybiBkcFtpXT1tYXgoRFAoaSsxKSxEUChpK1IrMSkrYVtpXSk7Cn0KaW50IG1haW4oKQp7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApO2Npbi50aWUoMCk7Y291dC50aWUoMCk7CiAgICBpbnQgdDsKICAgIGNpbj4+dDsKICAgIHdoaWxlKHQtLSkKICAgIHsKICAgICAgICBtZW1zZXQoYSwwLHNpemVvZihhKSk7CiAgICAgICAgbWVtc2V0KGRwLC0xLHNpemVvZihkcCkpOwogICAgICAgIGNpbj4+bj4+TD4+UjsKICAgICAgICBSPW1pbihMLFIpOwogICAgICAgIHdoaWxlKG4tLSkKICAgICAgICB7CiAgICAgICAgICAgIGludCB4OwogICAgICAgICAgICBjaW4+Png7CiAgICAgICAgICAgIGFbeF0rPXg7CiAgICAgICAgfQogICAgICAgIGNvdXQ8PERQKDApPDxlbmRsOwogICAgfQp9Cg==