#include #define rep(i,n) for(int i = 0; i < (n); ++i) #define fi first #define se second using namespace std; typedef long long int ll; // mod const int K = 20; const int mod = 1<=mod) x-=mod; return *this;} mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;} mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;} mint operator+(const mint& a)const{ return mint(*this) += a;} mint operator-(const mint& a)const{ return mint(*this) -= a;} mint operator*(const mint& a)const{ return mint(*this) *= a;} }; mint ex(mint a, ll t) { if(!t) return 1; mint res = ex(a,t/2); res *= res; return (t&1)?res*a:res; } // typedef pair P; P p[mod*2]; mint inv(mint a) { return ex(a,mod/2-1);} mint comb(int a, int b) { int c = a-b; int two = p[a].se-p[b].se-p[c].se; if (two >= K) return 0; mint res = p[a].fi*inv(p[b].fi)*inv(p[c].fi); res *= 1<>= 1; p[i].fi *= x; } rep(ti,ts) { int a,b,c; scanf("%d%d%d",&a,&b,&c); assert(1 <= a && a <= 1000000); assert(1 <= b && b <= 1000000); assert(1 <= c && c <= 1000000); // C(C(c+b-1,b)*c+a-1,a)*c mint x = comb(c+b-1,b)*c; mint y = comb((x+a-1).x+mod,a)*c; printf("%lld\n", y.x&1); } return 0; }