#include <bits/stdc++.h>
using namespace std;
int mod, ix, iy, idx, idy;
long long t;
void read() { cin >> mod >> ix >> iy >> idx >> idy >> t; }
int add(int a, int b) { return 1 + (1LL * a + b + mod - 1) % mod; }
int mul(int a, int b) { return 1 + (1LL * a * b + mod - 1) % mod; }
vector<vector<int> > mul(const vector<vector<int> > &a,
                         const vector<vector<int> > &b) {
  vector<vector<int> > c =
      vector<vector<int> >(a.size(), vector<int>(a.size()));
  for (int i = 0; i < a.size(); ++i)
    for (int j = 0; j < a.size(); ++j)
      for (int k = 0; k < a.size(); ++k)
        c[i][j] = 1 + (c[i][j] + 1LL * a[i][k] * b[k][j] + mod - 1) % mod;
  return c;
}
vector<vector<int> > matPow(long long n, vector<vector<int> > &p) {
  if (n == 0) {
    vector<vector<int> > ret =
        vector<vector<int> >(p.size(), vector<int>(p.size(), 0));
    for (int i = 0; i < p.size(); ++i) ret[i][i] = 1;
    return ret;
  }
  vector<vector<int> > ret = matPow(n / 2, p);
  return n & 1 ? mul(p, mul(ret, ret)) : mul(ret, ret);
}
void work() {
  int _mat[6][6] = {{2, 1, 1, 0, 1, 0}, {1, 2, 0, 1, 1, 0}, {1, 1, 1, 0, 1, 0},
                    {1, 1, 0, 1, 1, 0}, {0, 0, 0, 0, 1, 1}, {0, 0, 0, 0, 0, 1}};
  vector<vector<int> > mat;
  for (int i = 0; i < 6; ++i) mat.push_back(vector<int>(_mat[i], _mat[i] + 6));
  vector<vector<int> > ret = matPow(t, mat);
  int x = 0, y = 0;
  x = add(x, mul(ret[0][0], ix));
  x = add(x, mul(ret[0][1], iy));
  x = add(x, mul(ret[0][2], idx));
  x = add(x, mul(ret[0][3], idy));
  x = add(x, mul(ret[0][5], 1));
  y = add(y, mul(ret[1][0], ix));
  y = add(y, mul(ret[1][1], iy));
  y = add(y, mul(ret[1][2], idx));
  y = add(y, mul(ret[1][3], idy));
  y = add(y, mul(ret[1][5], 1));
  cout << 1 + (x + mod - 1) % mod << ' ' << 1 + (y + mod - 1) % mod << endl;
}
int main() {
  read();
  work();
  return 0;
}
