//#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") //#pragma GCC optimize("unroll-loops") #include #define N 1000005 #define LL long long using namespace std; int T,a,b,n;const int p=998244353; inline int power(int x,int y){ int z=1;while(y){ if(y&1) z=1ll*z*x%p;y>>=1,x=1ll*x*x%p; } return z; } struct FastIO{ static const int S=1048576; char buf[S],*L,*R;int stk[20],Top;~FastIO(){clear();} inline char nc(){return L==R&&(R=(L=buf)+fread(buf,1,S,stdin),L==R)?EOF:*L++;}inline void clear(){fwrite(buf,1,Top,stdout);Top=0;} inline void pc(char ch){Top==S&&(clear(),0);buf[Top++]=ch;}inline void endl(){pc('\n');} FastIO& operator >> (char&ch){while(ch=nc(),ch==' '||ch=='\n');return *this;} templateFastIO& operator >> (T&ret){ ret=0;int f=1;char ch=nc();while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=nc();} while(ch>='0'&&ch<='9'){ret=ret*10+ch-'0';ch=nc();}ret*=f;return *this; } FastIO& operator >> (char* s){int Len=0;char ch=nc();while(ch!='\n'){*(s+Len)=ch;Len++;ch=nc();}} templateFastIO& operator << (T x){ if(x<0){pc('-');x=-x;}do{stk[++stk[0]]=x%10;x/=10;}while(x); while(stk[0]) pc('0'+stk[stk[0]--]);return *this; } FastIO& operator << (char ch){pc(ch);return *this;} FastIO& operator << (string str){int Len=str.size()-1;for(stk[0]=0;Len>=0;Len--) stk[++stk[0]]=str[Len];while(stk[0]) pc(stk[stk[0]--]);return *this;} }fin,fout; int main(){ // freopen("data.in","r",stdin); // freopen("jxc.out","w",stdout); fin>>T;while(T--){ fin>>a>>b>>n; if(n&1){ int m=n/2,x=power(2,m);a=1ll*a*x%p,b=1ll*b*x%p;int A=(a+b)%p,B=(a-b+p)%p;cout<