#include using namespace std; using Int = long long; const char newl = '\n'; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a void drop(const T &x){cout< vector read(size_t n){ vector ts(n); for(size_t i=0;i>ts[i]; return ts; } //INSERT ABOVE HERE // n - 1, ..., n - d*2 + 1 Int calc(Int n,Int d){ if(d==0) return 0; return ((n-1)+(n-d*2+1))*d/2; } signed solve(){ Int n,r,c; cin>>n>>r>>c; Int d=min({r,c,n-1-r,n-1-c}); Int ans=calc(n,d)*4; r-=d;c-=d;n-=d*2; if(r==0){ ans+=c; }else if(c==n-1){ ans+=n-1; ans+=c; }else if(r==n-1){ ans+=n-1; ans+=n-1; ans+=(n-1)-c; }else if(c==0){ ans+=n-1; ans+=n-1; ans+=(n-1)-r; } cout<>T; while(T--) solve(); return 0; }