#include using namespace std; #define ll long long ll solve(int S, int C, int K){ ll res; if(S+C < K) return 0; if(K==1){ if(S==C){ res = (1LL << (S+1)) + 1; } else if (S < C){ res = (1LL << (C+1)) - 2; if(S) res += 3; } else { res = (1LL << S) + 1; } return res; } if(S < K) return 0; res = (1LL << (S+1-K)) + 1; if(S-C < K) res = res*2-1; return res; } int main(){ int S, C, K, T; scanf("%d",&T); while(T--){ scanf("%d%d%d",&S,&C,&K); printf("%lld\n", solve(S,C,K)); } return 0; }