#include using namespace std; #define fi first #define se second #define SZ(x) ((int)x.size()) #define lowbit(x) x&-x #define pb push_back #define ls (u<<1) #define rs (u<<1|1) #define ALL(x) (x).begin(),(x).end() #define UNI(x) sort(ALL(x)),x.resize(unique(ALL(x))-x.begin()) #define GETPOS(c,x) (lower_bound(ALL(c),x)-c.begin()) #define LEN(x) strlen(x) #define MS0(x) memset((x),0,sizeof((x))) #define Rint register int typedef unsigned int unit; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef pair pii; typedef pair pll; typedef vector Vi; typedef vector Vll; typedef vector Vpii; template void _R(T &x) { cin >> x; } void _R(int &x) { scanf("%d", &x); } void _R(ll &x) { scanf("%lld", &x); } void _R(ull &x) { scanf("%llu", &x); } void _R(double &x) { scanf("%lf", &x); } void _R(char &x) { scanf(" %c", &x); } void _R(char *x) { scanf("%s", x); } void R() {} template void R(T &head, U &... tail) { _R(head); R(tail...); } template void _W(const T &x) { cout << x; } void _W(const int &x) { printf("%d", x); } void _W(const ll &x) { printf("%lld", x); } void _W(const double &x) { printf("%.16f", x); } void _W(const char &x) { putchar(x); } void _W(const char *x) { printf("%s", x); } template void _W(const pair &x) {_W(x.fi); putchar(' '); _W(x.se);} template void _W(const vector &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); } void W() {} template void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); } const int MOD=998244353,mod=998244353; ll qpow(ll a,ll b) {ll res=1;a%=MOD; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;} const int MAXN=6e5+10,MAXM=2e6+10; const int INF=INT_MAX,SINF=0x3f3f3f3f; const ll llINF=LLONG_MAX; const int inv2=(MOD+1)/2; const int Lim=1<<20; ll a,b,k; void solve() { R(a,b,k); a=a*qpow(2,k/2)%MOD; b=b*qpow(2,k/2)%MOD; if(k&1) { W((a+b)%MOD,(a-b+MOD)%MOD); } else W(a,b); } int main() { srand(time(0)); //freopen("input.txt","w",stdout); //freopen("test_output.txt","w",stdout); int T=1;R(T); while(T--)solve(); return 0; }