#include<bits/stdc++.h>

using namespace std;
 
#define  GODSPEED       ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define  f              first                 
#define  s              second
#define  newl           cout<<"\n";
#define  pb             push_back  
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";newl;
#define  deb1(a)        cout<<a<<"\n";
#define  deb2(a,b)      cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());
#define  all(a)         a.begin(),a.end()           
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   N     =  5e5+5;
const ll   M     =  4e6+5;
const ll   mod   =  1e9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;

ll n, a, b;

ll fastmod(ll x, ll y = mod - 2){
	ll res = 1;
	while(y){
		if(y&1) res = res * x % mod;
		x = x * x % mod;
		y /= 2;
	}
	return res;
}

ll sum(ll x){
	return x * (x + 1) % mod * fastmod(2) % mod;
}

ll mul(ll x, ll y){
	return x * y % mod;
}

void solve(){
	cin >> n >> a >> b;
	ll x = n - b + 1;
	ll y = n - a - b + 1;
	ll z = n - a + 1;
	if(y <= 0){
		deb1(0)
		return;
	}
	ll s1 = mul(mul(sum(y), x), z), s2 = mul(sum(y), sum(y));
	deb1((4*(s1 - s2) + 4*mod) % mod)
}

int main(){
	GODSPEED;
	int test = 1;
	cin >> test;
	for(int i = 1; i <= test; i++){
		solve();
	}
}
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
typedef long long ll;
typedef long double ld;
using namespace std;

ll mod=1000000007;

int solve(){
	ll N, A, B;
	cin >> N >> A >> B;
	if(A+B>N){
		cout << 0 << endl;
		return 0;
	}
	if(A>B) swap(A, B);
	ll sum=(((N-A+1)*(N-A+1)%mod)*((N-B+1)*(N-B+1)%mod))%mod;
	ll h=min(A+B-1, N-A+1)%mod;
	ll f=h*(N-B+1)%mod, g=(h-B)*(h-B+1)%mod;
	(sum += mod-(f+mod-g)*(f+mod-g)%mod) %= mod;
	cout << sum << endl;
	return 0;
}

int main() {
	int T;
	cin >> T;
	for(int i=0; i<T; ++i){
		solve();
	}
	return 0;
}