#pragma GCC optimize("Ofast","inline","-ffast-math") #pragma GCC target("avx,sse2,sse3,sse4,mmx") #include #include #include #define MOD 998244353 using namespace __gnu_pbds; using namespace std; struct custom_hash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM); } }; inline int my_pow(int x,int y) { if(y==0) return 1; if(y==1) return x; int res=my_pow(x,y/2); if(y%2==0) return 1ll*res*res%MOD; else return 1ll*res*res%MOD*x%MOD; } signed main() { ios::sync_with_stdio(false); int t;cin>>t; while(t--){ int a,b,k; cin>>a>>b>>k; int v1=1ll*a*my_pow(2,k/2)%MOD,v2=1ll*b*my_pow(2,k/2)%MOD; if(k%2==1){ cout<<(v1+v2)%MOD<<" "<<(v1-v2+MOD)%MOD<<"\n"; } else{ cout<