#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using mat = vector<vector<ll>>;
mat mul(mat& a, mat& b, ll mod) {
  mat ret;
  ret.resize(a.size(), vector<ll>(b[0].size(), 0));
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < b[0].size(); j++) {
      for (int k = 0; k < b.size(); k++) {
        ret[i][j] = (ret[i][j] + a[i][k] * b[k][j]) % mod;
      }
    }
  }
  return ret;
}
void print(mat& m) {
  for (int i = 0; i < m.size(); i++) {
    for (int j = 0; j < m[i].size(); j++) {
      cout << m[i][j] << " ";
    }
    cout << "\n";
  }
}
mat fpow(mat base, ll e, ll mod) {
  mat ret(base.size(), vector<ll>(base.size(), 0));
  for (int i = 0; i < base.size(); i++) {
    ret[i][i] = 1;
  }
  while (e) {
    if (e & 1) {
      ret = mul(ret, base, mod);
    }
    base = mul(base, base, mod);
    e >>= 1;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  ll n, sx, sy, dx, dy, t;
  cin >> n >> sx >> sy >> dx >> dy >> t;
  sx--, sy--;
  mat A(6, vector<ll>(6, 0));
  A[0][0] = A[1][1] = 2;
  A[0][2] = A[0][3] = 1;
  A[1][0] = A[0][1] = A[1][2] = A[1][3] = 1;
  A[2][0] = A[2][2] = 1;
  A[3][1] = A[3][3] = 1;
  A[4][0] = A[4][1] = A[4][2] = A[4][3] = A[4][4] = 1;
  A[5][0] = A[5][1] = A[5][2] = A[5][3] = 2;
  A[5][4] = A[5][5] = 1;
  mat at(1, vector<ll>(6, 0));
  at[0][0] = sx;
  at[0][1] = sy;
  at[0][2] = dx;
  at[0][3] = dy;
  at[0][4] = 0;
  at[0][5] = 1;
  mat b = fpow(A, t, n);
  b = mul(at, b, n);
  while (b[0][0] < 0) b[0][0] += n;
  while (b[0][1] < 0) b[0][1] += n;
  cout << (b[0][0] + 1) << " " << (b[0][1] + 1) << endl;
  return 0;
}
