#include #define For(i,l,r) for (register int i=l; i<=r; i++) using namespace std; typedef unsigned long long LL; typedef signed long long ll; template inline void read(T &x) { char c = getchar(); int w = 1; x = 0; while (!isdigit(c)) (c == '-') && (w = -w), c = getchar(); while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar(); x *= w; } const ll mod = 998244353; ll T, a, b, k; inline ll ksm(ll x, ll k) { ll res = 1; while (k) { if (k & 1) res = res * x % mod; x = x * x % mod; k >>= 1; } return res; } signed main() { read(T); while (T -- > 0) { read(a); read(b); read(k); if (k & 1) { printf("%lld %lld\n", (a+b)%mod*ksm(2, k/2)%mod, (a-b+mod)%mod * ksm(2, k/2) % mod); } else { printf("%lld %lld\n", a * ksm(2, k/2) % mod, b * ksm(2, k/2) % mod); } } getchar(); return 0; }