#include #include using namespace std; using ll = long long; using mint = atcoder::modint998244353; #define rep(i, n) for (int i = 0; i < (int)(n); i++) template vector> mat_dot(const vector> &lhs, const vector> &rhs) { int sz = lhs.size(); vector res(sz, vector(sz, 0)); for (int i = 0; i < sz; i++) { for (int j = 0; j < sz; j++) { for (int k = 0; k < sz; k++) { res[i][j] += lhs[i][k] * rhs[k][j]; } } } return res; } template vector> mat_pow(const vector> &mat, long long n) { int sz = mat.size(); vector res(sz, vector(sz, 0)); for (int i = 0; i < sz; i++) { res[i][i] = 1; } auto now = mat; while (n > 0) { if (n & 1) { res = mat_dot(now, res); } now = mat_dot(now, now); n >>= 1; } return res; } void solve() { ll x1, y1, n; cin >> x1 >> y1 >> n; vector> mat = { {x1, -5 * y1, 0, 0}, {y1, x1, 0, 0}, {1, 0, 1, 0}, {0, 1, 0, 1}, }; auto a = mat_pow(mat, n); mint x = a[2][0] * x1 + a[2][1] * y1; mint y = a[3][0] * x1 + a[3][1] * y1; cout << x.val() << ' ' << y.val() << '\n'; } int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); int T = 1; for (int t = 0; t < T; t++) { solve(); } return 0; }