#include <bits/stdc++.h>
using namespace std;
int nn;
struct mat {
  long long a[10][10];
};
mat mul(mat a, mat b, long long mod) {
  mat tt;
  int i, j, k;
  memset(tt.a, 0, sizeof(tt.a));
  for (i = 0; i < nn; i++)
    for (j = 0; j < nn; j++)
      for (k = 0; k < nn; k++)
        tt.a[i][j] = ((tt.a[i][j] + a.a[i][k] * b.a[k][j]) % mod + mod) % mod;
  return tt;
}
mat matpow(mat a, long long b, long long mod) {
  mat s;
  memset(s.a, 0, sizeof(s.a));
  for (int i = 0; i < nn; i++) s.a[i][i] = 1;
  while (b) {
    if (b & 1LL) s = mul(s, a, mod);
    a = mul(a, a, mod);
    b = b >> 1;
  }
  return s;
}
void output(mat tt) {
  for (int i = 0; i < nn; i++) {
    for (int j = 0; j < nn; j++) printf("%lld ", tt.a[i][j]);
    printf("\n");
  }
  printf("\n");
}
int main() {
  long long n, m, tt, q, i, j, k, s, t, sx, sy, dx, dy;
  mat a, b, c, d;
  nn = 6;
  scanf("%I64d%I64d%I64d%I64d%I64d%I64d", &n, &sx, &sy, &dx, &dy, &t);
  q = n;
  memset(b.a, 0, sizeof(b.a));
  b.a[0][0] = 2;
  b.a[0][1] = 1;
  b.a[0][2] = 1;
  b.a[0][4] = 1;
  b.a[0][5] = 2;
  b.a[1][0] = 1;
  b.a[1][1] = 2;
  b.a[1][3] = 1;
  b.a[1][4] = 1;
  b.a[1][5] = 2;
  b.a[2][0] = 1;
  b.a[2][1] = 1;
  b.a[2][2] = 1;
  b.a[2][4] = 1;
  b.a[2][5] = 2;
  b.a[3][0] = 1;
  b.a[3][1] = 1;
  b.a[3][3] = 1;
  b.a[3][4] = 1;
  b.a[3][5] = 2;
  b.a[4][4] = 1;
  b.a[4][5] = 1;
  b.a[5][5] = 1;
  memset(a.a, 0, sizeof(a.a));
  a.a[0][0] = sx - 1;
  a.a[1][0] = sy - 1;
  a.a[2][0] = dx;
  a.a[3][0] = dy;
  a.a[5][0] = 1;
  c = mul(matpow(b, t, q), a, q);
  printf("%I64d %I64d\n", c.a[0][0] + 1, c.a[1][0] + 1);
  return 0;
}
