#include <bits/stdc++.h>
using namespace std;
long long n, sx, sy, dx, dy, t, y[10], p;
struct node {
  long long a[10][10];
  node() { memset(a, 0, sizeof(a)); }
  inline void build() {
    for (long long i = 1; i <= 6; i++) a[i][i] = 1;
  }
} x;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void init() {
  x.a[1][1] = 2;
  x.a[1][2] = 1;
  x.a[1][3] = 1;
  x.a[1][4] = 0;
  x.a[1][5] = 1;
  x.a[1][6] = 2;
  x.a[2][1] = 1;
  x.a[2][2] = 2;
  x.a[2][3] = 0;
  x.a[2][4] = 1;
  x.a[2][5] = 1;
  x.a[2][6] = 2;
  x.a[3][1] = 1;
  x.a[3][2] = 1;
  x.a[3][3] = 1;
  x.a[3][4] = 0;
  x.a[3][5] = 1;
  x.a[3][6] = 2;
  x.a[4][1] = 1;
  x.a[4][2] = 1;
  x.a[4][3] = 0;
  x.a[4][4] = 1;
  x.a[4][5] = 1;
  x.a[4][6] = 2;
  x.a[5][1] = 0;
  x.a[5][2] = 0;
  x.a[5][3] = 0;
  x.a[5][4] = 0;
  x.a[5][5] = 1;
  x.a[5][6] = 1;
  x.a[6][1] = 0;
  x.a[6][2] = 0;
  x.a[6][3] = 0;
  x.a[6][4] = 0;
  x.a[6][5] = 0;
  x.a[6][6] = 1;
  y[1] = sx - 1;
  y[2] = sy - 1;
  y[3] = dx;
  y[4] = dy;
  y[5] = 0;
  y[6] = 1;
}
node operator*(const node x, const node y) {
  node z;
  for (long long i = 1; i <= 6; i++)
    for (long long j = 1; j <= 6; j++)
      for (long long k = 1; k <= 6; k++)
        z.a[i][j] = (z.a[i][j] + x.a[i][k] * y.a[k][j] % p + p) % p;
  return z;
}
signed main() {
  n = read(), sx = read(), sy = read(), dx = read(), dy = read(), t = read();
  p = n;
  if (t == 0) {
    printf("%lld %lld", sx, sy);
    return 0;
  }
  init();
  node ans;
  ans.build();
  while (t) {
    if (t & 1) ans = ans * x;
    x = x * x;
    t >>= 1;
  }
  long long tx = 0, ty = 0;
  for (long long i = 1; i <= 6; i++)
    tx = (tx + y[i] * ans.a[1][i] % p + p) % p,
    ty = (ty + y[i] * ans.a[2][i] % p + p) % p;
  printf("%lld %lld", tx + 1, ty + 1);
  return 0;
}
