#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)

const ll mod = 1e9 + 7;

ll f1(ll n) {
    if (n < 0) return 0;
    ll res = n * (n + 1) / 2;
    return res % mod;
}

ll f2(ll n) {
    if (n < 0) return 0;
    ll res = f1(n);
    res %= mod;
    res *= res;
    res %= mod;
    return res;
}

void solve() {
    int n, a, b;
    cin >> n >> a >> b;
    ll x = ((f1(n - a - b + 1) * (n - b + 1) % mod) * (n - a + 1)) % mod;
    ll y = f2(n - a - b + 1) % mod;
    ll ans = (x*4) % mod - (y*4) % mod;
    cout << (ans + mod) % mod << endl;
}

int main() {
    int T;
    cin >> T;
    rep(t, T) {
        solve();
    }
}

#include<bits/stdc++.h>
#define debug(a) cout<<#a<<"="<<a<<endl
#define rep(i,a,b) for(ll i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(ll i=a,i##end=b;i>=i##end;--i)
#define erep(i,a) for(ll i=hd[a],y;(y=to[i]);i=nxt[i])
typedef long long ll;
using namespace std;
char IO;
inline ll rd() {
	ll res=0,f=1;
	while(IO=getchar(),IO<48||IO>57)if(IO=='-')f=0;
	do res=(res<<3)+(res<<1)+(IO^48);
	while(IO=getchar(),IO>=48&&IO<=57);
	if(f)return res;
	return -res;
}
inline void Max(ll &a,ll b) {
	((a<b)&&(a=b));
}
inline void Min(ll &a,ll b) {
	((a>b)&&(a=b));
}
bool let;
const ll P=1e9+7;
bool vio;
int main() {
//	printf("%.3f",(&vio-&let)/1024.0/1024);
	ll T=rd();
	while(T--) {
		ll n=rd(),a=rd(),b=rd();
		if(a<b)swap(a,b);
		ll tot=(n-a+1)*(n-a+1)%P*(n-b+1)%P*(n-b+1)%P;
		if(a+b>n) {
			ll t=((1+n-a)*(n-a)%P+(a-b+1)*(n-a+1)%P)%P;
			printf("%lld\n",((tot-t*t%P)%P+P)%P);
		} else {
			ll t=((n-a-b+2+n-a)*(b-1)%P+(a-b+1)%P*(n-a+1)%P)%P;
			printf("%lld\n",((tot-t*t%P)%P+P)%P);
		}
	}
}