#include <bits/stdc++.h>   using namespace std;   vector<vector<long long> > mul(const vector<vector<long long> > &a,                                  const vector<vector<long long> > &b,                                  const long long &mod) {     int R1 = a.size(), C1 = a.front().size();     int R2 = b.size(), C2 = b.front().size();     if (C1 != R2) return vector<vector<long long> >();     vector<vector<long long> > result(R1, vector<long long>(C2, 0));     for (int i = 0; i < R1; ++i) {       for (int j = 0; j < C2; ++j) {         for (int k = 0; k < C1; ++k) {           result[i][j] += a[i][k] * b[k][j] % mod;           result[i][j] %= mod;         }       }     }     return result;   }   int main() {     vector<vector<long long> > transformer = {         {2, 1, 1, 0, 1, 1}, {1, 2, 0, 1, 1, 1}, {1, 1, 1, 0, 1, 1},         {1, 1, 0, 1, 1, 1}, {0, 0, 0, 0, 1, 1}, {0, 0, 0, 0, 0, 1}};     vector<vector<long long> > base(6, vector<long long>(1));     long long n, t;     cin >> n;     for (int i = 0; i < 4; ++i) {       cin >> base[i][0];       base[i][0] = (base[i][0] % n + n) % n;     }     cin >> t;     base[0][0]--;     base[1][0]--;     base[4][0] = base[5][0] = 1;     vector<vector<long long> > result(6, vector<long long>(6, 0));     for (int i = 0; i < 6; ++i) result[i][i] = 1;     while (t) {       if (t & 1) result = mul(result, transformer, n);       transformer = mul(transformer, transformer, n);       t >>= 1;     }     result = mul(result, base, n);     cout << result[0][0] + 1 <<     << result[1][0] + 1 << endl;     return 0;   }   