#include <bits/stdc++.h>
using namespace std;
const int N = 10;
long long mod;
struct matrix {
  int n, m;
  long long v[N][N];
  matrix() {
    n = m = 0;
    memset(v, 0, sizeof(v));
  }
  matrix operator*(const matrix &a) const {
    matrix res;
    res.n = n, res.m = a.m;
    for (register int i = 1; i <= n; i++)
      for (register int j = 1; j <= a.m; j++)
        for (register int k = 1; k <= m; k++)
          res.v[i][j] = (res.v[i][j] + v[i][k] * a.v[k][j] % mod + mod) % mod;
    return res;
  }
};
int main() {
  long long sx, sy, dx, dy, t;
  scanf("%lld%lld%lld%lld%lld%lld", &mod, &sx, &sy, &dx, &dy, &t);
  matrix ans, buf;
  ans.n = 1, ans.m = 6;
  ans.v[1][1] = sx - 1, ans.v[1][2] = sy - 1, ans.v[1][3] = dx,
  ans.v[1][4] = dy, ans.v[1][5] = 0, ans.v[1][6] = 1;
  buf.n = buf.m = 6;
  buf.v[1][1] = 2, buf.v[1][2] = buf.v[1][3] = buf.v[1][4] = 1;
  buf.v[2][2] = 2, buf.v[2][1] = buf.v[2][3] = buf.v[2][4] = 1;
  buf.v[3][1] = buf.v[3][3] = 1;
  buf.v[4][2] = buf.v[4][4] = 1;
  buf.v[5][1] = buf.v[5][2] = buf.v[5][3] = buf.v[5][4] = buf.v[5][5] = 1;
  buf.v[6][1] = buf.v[6][2] = buf.v[6][3] = buf.v[6][4] = 2,
  buf.v[6][5] = buf.v[6][6] = 1;
  while (t) {
    if (t & 1) ans = ans * buf;
    t >>= 1;
    buf = buf * buf;
  }
  printf("%lld %lld\n", ans.v[1][1] + 1, ans.v[1][2] + 1);
  return 0;
}
