#include using namespace std; #define fr first #define sc second #define pb push_back typedef long long ll; typedef pairpii; const int inf = 0x3f3f3f3f; const int mod = 998244353; const double pi = acos(-1.0); const ll INF = 0x3f3f3f3f3f3f3f3f; #define rep(i,x,y) for(auto i=(x);i<=(y);++i) #define dep(i,x,y) for(auto i=(x);i>=(y);--i) const int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 }; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll poww(ll a, ll b) { ll s = 1; while (b) { if (b & 1)s = (s * a) % mod; a = (a * a) % mod; b >>= 1; }return s % mod; } /*----------------------------------------------------------------------------------------------------------------------*/ const int N = 1e6 + 11; ll n,m; void solve() { ll a,b,k; cin>>a>>b>>k; n=k/2; k-=n*2; a=a*poww(2,n)%mod; b=b*poww(2,n)%mod; if(k) { n=a;m=b; a=n+m; b=n-m; a=(a%mod+mod)%mod; b=(b%mod+mod)%mod; } cout<> T; while (T--)solve(); return 0; }