#include #include #include #include #include #include #include using namespace std; #define int long long #define endl "\n" #define debug(x) cerr << "\e[1;31m" << #x << " = " << (x) << "\e[0m\n" templateostream & operator<<(ostream &out,vector &v){ for(T i:v)out<istream & operator>>(istream &in,vector &v){ for(T &i:v)in>>i; return in; } void init(); void task(); int32_t main(){ int t=1; init(); cin>>t; while(t--)task(); } void init(){} const int m=998244353; inline int fastPower(int x,unsigned int y,int p){ int res = 1; x = (x+m) % p; while (y > 0){ if (y & 1)res = (res*x) % p; y = y>>1; x = (x*x) % p; } return res; } void task(){ int a,b,k; cin>>a>>b>>k; bool flag=0; if(k&1){ flag=true; k--; } int t=fastPower(2,k/2,m); a=(t*a+m)%m; b=(t*b+m)%m; if(flag){ t=(a+b+m)%m; b=(a-b+m)%m; a=t; } cout<