#include #include #include using namespace std; typedef long long ll; const int MOD = 998244353; ll qpow(ll x, ll n) { ll res = 1; while (n > 0) { if (n & 1) res = res * x % MOD; x = x * x % MOD; n /= 2; } return res; } ll x, y, n; int main() { int T; scanf("%d", &T); while (T--) { scanf("%lld%lld%lld", &x, &y, &n); ll g = qpow(2, n / 2); x = x * g % MOD, y = y * g % MOD; if (n % 2) { ll a = x, b = y; x = (a + b) % MOD; y = (a + MOD - b) % MOD; } printf("%lld %lld\n", x, y); } return 0; }