#include <bits/stdc++.h>
using namespace std;
#define lc (rt << 1)
#define rc ((rt << 1) | 1)
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define rep(i, l, r) for (int i = (l); i <= (r); ++i)
#define per(i, r, l) for (int i = (r); i >= (l); --i)
#define PE(i, u) for (int i = head[u]; i != -1; i = edge[i].next)
typedef long long LL;
const int maxn = 1e6 + 20;
const int mod = 1e9 + 7;

LL y;
LL qpow(LL a, int n){
    LL res = 1;
    while(n){
        if(n & 1){
            res = res * a % mod;
        }
        n >>= 1;
        a = a * a % mod;
    }
    return res;
}

LL cal(LL t){
    return t * (t + 1) % mod * y % mod;
}
int main(int argc, char const *argv[])
{
    y = qpow(2, mod - 2);
    int t;
    scanf("%d", &t);
    while(t--){
        LL n, a, b;
        scanf("%lld%lld%lld", &n, &a, &b);
        // printf("[%lld %lld %lld]\n", n, a, b);

        if(a > b) swap(a, b);
        // printf("[%lld %lld %lld]\n", n, a, b);
        LL num1 = (n - a + 1) * (n - a + 1) % mod, num2 = (n - b + 1) * (n - b + 1) % mod;
        // printf("num1 = %lld num2 = %lld\n", num1, num2);
        LL ans = num1 * num2 % mod;
        // printf("777ans = %lld\n", ans);
        ans = (ans - (b - a + 1) * (b - a + 1) % mod * num2 % mod + mod) % mod;
        // printf("88ans = %lld\n", ans);
        LL ma = min(a - 1, n - b);
        // printf("ma = %lld\n", ma);
        // printf("7777\n");
        LL res = cal(ma) * (b - a + 1) % mod * (n - b + 1) % mod;
        // printf("res = %lld\n", res);
        // printf("9999\n");
        if(n - b > a - 1){
            res = (res + (n - b - a + 1) * (a - 1) % mod * (b - a + 1) % mod * (n - b + 1) % mod) % mod;
        }
        // printf("res = %lld\n", res);
        ans = (ans - 4LL * res % mod + mod) % mod;

        ma = min(b + a - 1, n);
        LL mi = min(b + 1, ma);
        // printf("a = %lld\n", a);
        if(a != 1){
            // printf("ansans = %lld\n", ans);
            // printf("[ma = %lld mi = %lld]\n", ma, mi);
            LL num3 = (cal(ma - 1) - cal(mi - 2) + mod) % mod;
            // printf("num3 = %lld\n", num3);
            res = (n * n % mod * (ma - mi + 1) % mod * (ma - mi + 1) % mod - n * num3 % mod * (ma - mi + 1) % mod * 2LL % mod + num3 * num3 % mod + 10LL * mod) % mod;
            // printf("res = %lld\n", res);
            ans = (ans - 4LL * res % mod + mod) % mod;
        }

        printf("%lld\n", ans);
    }
    return 0;
}
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

LL sub(LL a, LL b) { return (a - b + kMod) % kMod; }
LL mul(LL a, LL b) { return a * b % kMod; }

LL solve() {
  LL N, A, B; cin >> N >> A >> B;
  if (N < A + B) return 0;

  LL all = mul(N - A + 1, N - B + 1);
  LL X3 = mul(N - A - B + 1, N - A - B + 2);
  LL X2 = sub(all, X3);
  LL X1 = mul(X2, X2);

  return sub(mul(all, all), X1);
}

int main() {
  int T; cin >> T;
  for (int i = 0; i < T; ++i) {
    std::cout << solve() << endl;
  }
}
