#include #include #include using namespace std; int q, i, j, I, J, N; int main(){ cin >> q; int ans[q]; for(i = 0; i < q; i++){ cin >> N >> I >> J; int tmp = min(min(I, N - I - 1), min(N - J - 1, J)); ans[i] = (N * tmp * 4) - (tmp * tmp * 4); if(tmp == I){ ans[i] += J - tmp; }else if(tmp == N - J - 1){ ans[i] += I - tmp + N - tmp * 2 - 1; }else if(tmp == N - I - 1){ ans[i] += (N - tmp * 2 - 1) * 2 + N - J - 1 - tmp; }else{ ans[i] += (N - tmp * 2 - 1) * 3 + N - I - 1 - tmp; } } for(i = 0; i < q; i++) cout << ans[i] << endl; return 0; }