#pragma comment(linker, "/STACK:1024000000,1024000000") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define debug() puts("++++") #define print(x) cout<<"====== "<<(x)<<" ====="< P; const int INF = 0x3f3f3f3f; const LL LNF = 1e17; const double inf = 1e20; const double PI = acos(-1.0); const double eps = 1e-12; const int maxn = 1e5 + 7; const int maxm = 3000 + 7; const LL mod = 998244353; const int dr[] = {-1, 1, 0, 0, 1, 1, -1, -1}; const int dc[] = {0, 0, 1, -1, 1, -1, 1, -1}; int n, m; inline bool is_in(int r, int c) { return r >= 0 && r < n && c >= 0 && c < m; } inline int read_int(){ int x; scanf("%d", &x); return x; } LL fast_pow(LL a, int n){ LL res = 1; while(n){ if(n&1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main(){ LL a, b; int T; cin >> T; while(T--){ scanf("%lld %lld %d", &a, &b, &n); LL res_a, res_b; if(n & 1){ LL x = fast_pow(2, n - 1 >> 1); res_a = x * (a + b) % mod; res_b = _mod(x * (a - b)); } else { LL x = fast_pow(2, n>>1); res_a = x * a % mod; res_b = x * b % mod; } printf("%lld %lld\n", res_a, res_b); } return 0; }