#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } constexpr long long MAX = 5100000; constexpr long long INF = 1LL << 60; constexpr int inf = 1000000007; constexpr long long mod = 1000000007LL; //constexpr long long mod = 998244353LL; using namespace std; typedef unsigned long long ull; typedef long long ll; void suzuken() { ll n, i, j; scanf("%lld %lld %lld", &n, &i, &j); ll mn = min({ i,j,n - 1 - i, n - 1 - j }); ll len = n - mn * 2; ll tmp = ((n - 1) * 4 + (n - 1) * 4 + (mn - 1) * (-8)) * mn / 2; if (mn == i) { cout << tmp + j - mn << "\n"; return; } tmp += len - 1; if (mn + len - 1 == j) { cout << tmp + i - mn << "\n"; return; } tmp += len - 1; if (mn + len - 1 == i) { cout << tmp + (mn + len - 1) - j << "\n"; } tmp += len - 1; cout << tmp + (mn + len - 1) - i << "\n"; } int main() { /* cin.tie(nullptr); ios::sync_with_stdio(false); */ ll kkt; scanf("%lld", &kkt); while (kkt--) { suzuken(); } return 0; }