#include #define mp make_pair #define fi first #define se second #define debug(x) cerr << #x << " = " << (x) << endl #define EPS 1e-9 #define PI acos(-1.0) using namespace std; void test() { cerr << endl; } template void test(T x, Args... args) { cerr << x << " "; test(args...); } typedef long long ll; typedef pair pii; typedef pair pll; const int MAXN = (int)1e5 + 10; const int MOD = 998244353; const int INF = 1e9; ll power(ll a, ll b) { ll res = 1; while(b) { if(b & 1) res = res * a % MOD; a = a * a % MOD; b /= 2; } return res; } void Main() { ll a, b, k; cin >> a >> b >> k; a = power(2, k/2) * a % MOD; b = power(2, k/2) * b % MOD; if (k & 1) { ll aa = a, bb = b; a = (aa + bb) % MOD; b = (aa - bb + MOD) %MOD; } cout << a << " " << b << "\n"; } int main() { #ifdef BanFcc freopen("in.txt", "r", stdin); /// freopen("out.txt", "w", stdout); #else ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0); cout << fixed << setprecision(10); #endif int T = 1; cin >> T; for (int ca = 1; ca <= T; ca++) { // cout << "Case #" << ca << ": "; Main(); } return 0; }