#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ld = double;
const ld EPS = 1e-9;
const int MOD = 1e9 + 7;
const ld PI = 3.141592653589793;
const int maxn = 600001;
struct cd {
  ld fi, se;
  cd(ld fi, ld se) : fi(fi), se(se) {}
  cd operator*(const cd &rhs) {
    return {fi * rhs.fi - se * rhs.se, fi * rhs.se + se * rhs.fi};
  }
  cd operator+(const cd &rhs) { return {fi + rhs.fi, se + rhs.se}; }
  cd operator-(const cd &rhs) { return {fi - rhs.fi, se - rhs.se}; }
};
void fast_io() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
}
using mat = array<array<ll, 6>, 6>;
using vec = array<ll, 6>;
int n;
ll add(ll a, ll b) {
  a += b;
  a %= n;
  return a;
}
mat mul(mat fi, mat se) {
  mat res;
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 6; ++j) {
      res[i][j] = 0;
      for (int e = 0; e < 6; ++e) {
        res[i][j] = add(res[i][j], fi[i][e] * se[e][j] % n);
      }
    }
  }
  return res;
}
mat pw(mat m, ll b) {
  mat res;
  bool in = false;
  for (; b; b >>= 1) {
    if (b & 1) {
      if (!in) {
        in = true;
        res = m;
      } else {
        res = mul(res, m);
      }
    }
    m = mul(m, m);
  }
  return res;
}
array<ll, 6> mul(mat m, array<ll, 6> v) {
  array<ll, 6> res = {};
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 6; ++j) {
      res[i] = add(res[i], m[i][j] * v[j] % n);
    }
  }
  return res;
}
mat tr;
signed main() {
  42;
  auto solve = [](int _) -> void {
    int sx, sy, dx, dy;
    ll t;
    cin >> n >> sx >> sy >> dx >> dy;
    cin >> t;
    if (t == 0) {
      cout << sx << " " << sy;
      return;
    }
    --sx;
    --sy;
    ((dx %= n) += n) %= n;
    ((dy %= n) += n) %= n;
    tr = {{{2, 1, 1, 0, 1, 2},
           {1, 2, 0, 1, 1, 2},
           {1, 1, 1, 0, 1, 2},
           {1, 1, 0, 1, 1, 2},
           {0, 0, 0, 0, 1, 1},
           {0, 0, 0, 0, 0, 1}}};
    auto res = pw(tr, t);
    array<ll, 6> state = {sx, sy, dx, dy, 0, 1};
    auto ans = mul(res, state);
    cout << ans[0] + 1 << " " << ans[1] + 1 << endl;
  };
  fast_io();
  cout.precision(9);
  cout << fixed;
  int t = 1;
  for (int i = 1; i <= t; ++i) solve(i);
}
