#include using namespace std; typedef long long Lint; const Lint mod = 998244353; Lint fpow(Lint a, Lint b, Lint mod) { Lint res = 1; for (; b; b >>= 1) { if (b & 1) res = res * a % mod; a = a * a % mod; } return res; } void solve() { Lint a, b, k; cin >> a >> b >> k; Lint res1, res2; Lint tmp = fpow(2, k >> 1, mod); if (k & 1) { res1 = tmp * (a + b) % mod; res2 = tmp * (a + mod - b) % mod; } else { res1 = tmp * a % mod; res2 = tmp * b % mod; } cout << res1 << ' ' << res2 << '\n'; } int main() { int T; cin >> T; while (T--) solve(); return 0; }