#include #include using namespace std; using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; using mint = modint998244353; const int mod = 998244353; //const int INF = 1e9; //const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n) - 1; i >= 0; --i) #define rrep2(i,l,r)for(int i=(r) - 1;i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define P pair template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } #include template std::vector> matrixMul(const std::vector>&A, const std::vector>&B) { std::vector> C(A.size(), std::vector(B[0].size())); for (int i = 0; i < (int)A.size(); ++i) { for (int k = 0; k < (int)A[0].size(); ++k) { for (int j = 0; j < (int)B[0].size(); ++j) { C[i][j] += A[i][k] * B[k][j]; } } } return C; } template std::vector> matrixPow(long long n, std::vector> mat) { int size = (int)mat.size(); vector> mret(size, vector(size)); for (int i = 0; i < size; ++i) { mret[i][i] = 1; } while (n > 0) { if (1 & n) mret = matrixMul(mat, mret); mat = matrixMul(mat, mat); n >>= 1; } return mret; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); long long x, y, n; cin >> x >> y >> n; vector mat(4, vector(4)); mat[0] = { x,-5 * y,0,0 }; mat[1] = { y,x,0,0 }; mat[2] = { 1,0,1,0 }; mat[3] = { 0,1,0,1 }; mat = matrixPow(n, mat); mint xa = x * mat[2][0] + y * mat[2][1]; mint ya = x * mat[3][0] + y * mat[3][1]; cout << xa.val() << " " << ya.val() << endl; return 0; }