#include <bits/stdc++.h>
 
//#include <atcoder/modint>
 
 
#define inc(i, n) for (int i = 0; i < (n); i++)
#define incs(i, s, n) for (int i = (s); i < (n); i++)
 
//#define yes printf("Yes\n")
//#define no printf("No\n")
 
 
using namespace std;
//using mint = atcoder::modint998244353;
//using pii = pair<int, int>;F
using ll = long long;
 
const int ARR_SIZE = 5e3+2;
const double epsilon = 0.5;
 
int main(int argc, char const *argv[])
{   
    int N;
    scanf("%d", &N);

    ll ans = 0;
    inc(i, N) {
        ll A, B;
        scanf("%lld%lld", &A, &B);

        ans += (A+B)*(B-A+1)/2;
    }
    printf("%lld\n", ans);
    
    return 0;
}
#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;
using ll = long long;

template<typename T>
T pown(T b, ll e) {
    if(e == 0) return 1;
    T p = pown(b, e / 2);
    if(e % 2 == 0) return p * p;
    return p * p * b;
}

template<const int mod>
struct Intmod {
    ll a;
    Intmod(ll a = 0): a(((a % mod) + mod) % mod) {}

    Intmod operator-() const {return Intmod(-a);}

    Intmod& operator+=(const Intmod b) {
        if((a += b.a) >= mod) a -= mod;
        return *this;
    }
    Intmod& operator+=(const ll b) {
        if((a += b) >= Intmod(mod).a) a -= mod;
        return *this;
    }
    Intmod& operator-=(const Intmod b) {
        if((a -= b.a) < 0) a += mod;
        return *this;
    }
    Intmod& operator-=(const ll b) {
        if((a -= Intmod(b).a) < 0) a += mod;
        return *this;
    }
    Intmod& operator*=(const Intmod b) {
        (a *= b.a) %= mod;
        return *this;
    }
    Intmod& operator*=(const ll b) {
        (a *= Intmod(b).a) %= mod;
        return *this;
    }

    template<typename T> Intmod operator+(const T b) const {return Intmod(*this) += b;}
    template<typename T> Intmod operator-(const T b) const {return Intmod(*this) -= b;}
    template<typename T> Intmod operator*(const T b) const {return Intmod(*this) *= b;}

    // Valid for prime mod. pown() needs to be included.
    int i = 0;
    Intmod inv() {
        if(a == 0) throw "Inverse of zero does not exist.";
        if(!i) i = pown(*this, mod - 2).a;
        return Intmod(i);
    }
    Intmod& operator/=(const Intmod b) {return *this *= b.inv();}
    Intmod& operator/=(const ll b) {return *this *= Intmod(b).inv();}
    template<typename T> Intmod operator/(const T b) const {return Intmod(*this) /= b;}
};
template<const int mod> Intmod<mod> operator+(const ll b, Intmod<mod> a) {return a += b;}
template<const int mod> Intmod<mod> operator-(const ll b, Intmod<mod> a) {return a -= b;}
template<const int mod> Intmod<mod> operator*(const ll b, Intmod<mod> a) {return a *= b;}
template<const int mod> Intmod<mod> operator/(const ll b, Intmod<mod> a) {return a /= b;} //Valid for prime mod.

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    const int MOD = 1000000007;

    int t;
    cin >> t;
    ll n, a, b;
    Intmod<MOD> mul1 = 1, mul2 = 1, sab = 0, sab1 = 0, sab2 = 0, ans = 0;
    rep(i, t) {
        cin >> n >> a >> b;

        if(n < a + b) {
            printf("0\n");
            continue;
        }

        mul1 = 1;
        mul2 = 1;
        mul1 *= n - a + 1;
        mul1 *= n - b + 1;
        mul1 *= 2;
        sab = n;
        sab -= a;
        sab -= b;
        sab1 = sab;
        sab1 += 1;
        sab2 = sab;
        sab2 += 2;
        mul2 *= sab2;
        mul2 *= sab1;
        ans = mul1;
        ans -= mul2;
        ans *= mul2;

        printf("%lld\n", ans.a);
    }

    return 0;
}