#include<bits/stdc++.h>
using namespace std;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,a,b) for(i=(a);i<=(b);++i)
#define per(i,a,b) for(i=(a);i>=(b);--i)
#define REP(i,a,b) for(i=(a);i< (b);++i)
#define PER(i,a,b) for(i=(a);i> (b);--i)
#define ERR(...) fprintf(stderr,__VA_ARGS__)
template<class T>inline void cmn(T &x,const T &a){if(a<x)x=a;}
template<class T>inline void cmx(T &x,const T &a){if(x<a)x=a;}
template<class T>inline bool bmn(T &x,const T &a){if(a<x){x=a;return true;}else return false;}
template<class T>inline bool bmx(T &x,const T &a){if(x<a){x=a;return true;}else return false;}

const int p=998244353;
inline void add(int &x){if(x>=p)x-=p;}
#define MUL(a,b) ((0ll|(a))*(b)%p)

const int MAXN=101,MAXS=5005;
int Fc[MAXN],W[MAXN],F[MAXN][MAXS];
signed main(){
#ifdef ONLINE_JUDGE
	//freopen("problemname.in","r",stdin);
	//freopen("problemname.out","w",stdout);
#endif
	int N;
	scanf("%d",&N);
	int i,s=0;
	{
		int m=0,a;
		REP(i,0,N){
			scanf("%d",&a);
			cmx(m,a);s+=a;W[i]=a;
		}
		if((s&1)||m>(s>>1)){
			puts("0");
			return 0;
		}
	}
	int goal=(s>>1);
	Fc[0]=s=1;rep(i,1,N)Fc[i]=s=MUL(s,i);
	sort(W,W+N);
	int a,b,w;
	s=0;F[0][0]=1;
	REP(i,0,N){
		w=W[i];
		per(a,i,0)per(b,min(s,goal-w),0)add(F[a+1][b+w]+=F[a][b]);
		s+=w;
	}
	ll Ans=0ll;
	rep(i,0,N)if(a=F[i][goal])Ans=(Ans+a*MUL(Fc[i],Fc[N-i]))%p;
	printf("%d\n",int(Ans));
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<int, int>;
using namespace std;

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

constexpr ll mod = 1e9 + 7;

int main() {
    int T;
    cin >> T;

    rep(t, T) {
        ll N, A, B;
        cin >> N >> A >> B;

        if (N - A - B < 0) {
            cout << 0 << endl;
            continue;
        }

        ll a = ((N-A+1) * (N-A+1) % mod) * ((N-B+1) * (N-B+1) % mod);
        a %= mod;
        ll b = ((N-A+1)*(N-B+1)%mod) - ((N-A-B+2)*(N-A-B+1)%mod);
        b = (b + mod) % mod;

        cout << (((a - (b*b)%mod)+mod) % mod) << endl;
    }

}
