#include using namespace std; using ll=long long; #include using namespace atcoder; using mint=modint998244353; mint solve(ll A,ll B,ll K){ if(B==0||B==1){ if(A>0)return A*K; else return 0; } else if(B==-1){ if(A<0)return (-A)*(K-1); else return A*K; } if((B>=0&&A<0)||A==0){ return 0; } else if(A<0){ if(K%2==1){ return -mint(A)*mint(B).pow(K-1); } else{ return -mint(A)*mint(B).pow(K-2)*2; } } else if(B>0){ return mint(A)*mint(B).pow(K-1); } else if(K%2==1){ return mint(A)*mint(B).pow(K-1); } else{ return mint(A)*mint(B).pow(K-2)*2; } } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); ll T; cin>>T; while(T--){ ll A,B,K; cin>>A>>B>>K; mint an=solve(A,B,K); cout<