#include using namespace std; const int mo=998244353; int Pow(int a,int b){ int r=1; for(;b;b>>=1,a=1LL*a*a%mo) if(b&1)r=1LL*r*a%mo; return r; } int main(){ #ifdef flukehn freopen("f.in","r",stdin); #endif ios::sync_with_stdio(0); cin.tie(0); int T; cin>>T; while(T--){ int a,b,k; cin>>a>>b>>k; int t=Pow(2,k/2); a=1LL*a*t%mo; b=1LL*b*t%mo; if(k%2){ int u=a,v=b; a=(u+v)%mo; b=(u-v+mo)%mo; } cout<