#include using namespace std; #define INF 1000000000 #define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++) typedef long long LL; LL n1[11]; LL n2[11]; LL m[11]; LL A[11][70]; LL ans; int dp[62][100001]; int main(){ int d; cin>>d; REP(i,d){ cin>>n1[i]>>n2[i]; cin>>m[i]; REP(j,m[i]){ cin>>A[i][j]; } } REP(i,d){ ans=0; vector v; LL nn1=n1[i]; LL nn2=n2[i]; LL mm=m[i]; REP(j,m[i]){ v.push_back(A[i][j]); } sort(v.begin(),v.end()); vectors(60,0); REP(j,m[i]){ if(j==0){ s[0]=v[0]; }else{ s[j]=s[j-1]+v[j]; } } int check=0; REP(j,m[i]){ check++; if(s[j]>nn1+nn2){ break; } } REP(j,check+1){ REP(k,100001){ dp[j][k]=0; } } dp[0][0]=1; for(int j=1;j=0;j--){ for(int k=s[j-1]-nn1;k<=nn2;k++){ if(dp[j][k]==1){ cout<