pozhen | 2021-08-01 19:00:23
# 2
#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
typedef long long LL;
const LL mod=998244353;
LL QuickPower(LL a,LL b){
LL ans=1;
while(b){
if(b&1){
ans=(ans*a)%mod;
}
b>>=1;
a=(a*a)%mod;
}
return ans;
}
int main()
{
int T,t,t_2;
LL a,b,c,result_a,result_b;
char x;
scanf("%d",&T);
while(T--)
{
t=0;
scanf("%lld%lld%lld",&a,&b,&c);
if(a==0&&b==0)
{
printf("0 0\n");
continue;
}
if(a==0&&b!=0)
{
if(c%2)
{
c/=2;
printf("%lld %lld\n",QuickPower(2,c)*b%mod,\
-QuickPower(2,c)*b%mod);
}
else
{
c/=2;
printf("0 %lld\n",QuickPower(2,c)*b%mod);
}
continue;
}
if(a!=0&&b==0)
{
if(c%2)
{
c/=2;
printf("%lld %lld\n",QuickPower(2,c)*a%mod,\
QuickPower(2,c)*a%mod);
}
else
{
c/=2;
printf("%lld 0\n",QuickPower(2,c)*a%mod);
}
continue;
}
if(c%2==0)
{
c/=2;
printf("%lld %lld\n",QuickPower(2,c)*a%mod,\
QuickPower(2,c)*b%mod);
}
else
{
c/=2;
result_a=(QuickPower(2,c)*a%mod+QuickPower(2,c)*b%mod)%mod;
result_b=(QuickPower(2,c)*a%mod-QuickPower(2,c)*b%mod)%mod;
printf("%lld %lld\n",result_a,result_b);
}
}
return 0;
}