#include #include #define sc(x) scanf("%lld",&x) #define int long long using namespace std; const int mod = 998244353; int qpwd(int x, int n) { int t(1); if (n == 0)return 1; if (n == 1)return x; while (n > 0) { if (n & 1) { t = x * t % mod; } n = n >> 1; x = x * x % mod; } return t; } signed main(void) { int t; sc(t); while (t--) { int a, b, k; sc(a); sc(b); sc(k); if (a == 0 && b == 0) { printf("0 0\n"); continue; } if (k & 1) { int t1 = (a + b) % mod; int t2 = (a - b) % mod; if (t2 < 0)t2 += mod; a = t1; b = t2; } int tt = qpwd(2, k / 2); a = tt * a % mod; b = tt * b % mod; printf("%lld %lld\n", a, b); } return 0; }