#include using namespace std; typedef long long ll; typedef int _loop_int; #define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i) #define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i) #define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i) #define DEBUG(x) cout<<#x<<": "<n)return 0; if(k==0 || k==n)return 1; if(n%2==0 && k%2==1)return 0; return parity(n/2, k/2); } void extgcd(ll a,ll b,ll &x,ll &y){ x=1; y=0; if(b!=0){ extgcd(b,a%b,y,x); y -= (a/b) * x; } } ll modinv(ll v,ll m){ ll x,y; extgcd(v,m,x,y); return (x+m)%m; } const int YO = 2521830; ll fact[YO]; ll bow[YO]; int main(){ const int MO = 1<<20; fact[0] = 1; bow[0] = 0; FOR(i,1,YO){ int v = i; bow[i] = bow[i-1]; while(v%2==0){ bow[i]++; v/=2; } fact[i] = fact[i-1]*v % MO; } int t; scanf("%d",&t); while(t--){ int a,b,c; scanf("%d%d%d",&a,&b,&c); if(c%2==0){ puts("0"); continue; } // C * comb(C*comb(C+B-1,B)+A-1,A) mod 2 // parity check with C*comb(C+B-1,B)+A-1, A // so we need (C*comb(C+B-1,B)+A-1) mod 2^20 ll x = fact[c+b-1] * modinv(fact[b],MO) % MO * modinv(fact[c-1],MO) % MO * c % MO; ll bin = bow[c+b-1] - bow[b] - bow[c-1]; while(x!=0 && bin>0){ x = x*2%MO; bin--; } x = (x+a-1+MO)%MO; int bitflag = 31-__builtin_clz(a); bitflag = (1<