#include <bits/stdc++.h>
using namespace std;
struct M {
  long long a[6][6];
  M() { memset(a, 0, sizeof(a)); }
} a, b;
long long n, sx, sy, dx, dy, t, c[6];
M operator*(M a, M b) {
  M r;
  for (int i = 0; i < 6; i++)
    for (int j = 0; j < 6; j++)
      for (int k = 0; k < 6; k++) (r.a[i][j] += a.a[i][k] * b.a[k][j]) %= n;
  return r;
}
int main() {
  cin >> n >> sx >> sy >> dx >> dy >> t;
  c[0] = dx;
  c[1] = dy;
  c[2] = sx;
  c[3] = sy;
  c[4] = 0;
  c[5] = 1;
  a.a[0][0] = a.a[0][2] = a.a[0][3] = a.a[0][4] = a.a[1][1] = a.a[1][2] =
      a.a[1][3] = a.a[1][4] = a.a[2][0] = a.a[2][3] = a.a[2][4] = a.a[3][1] =
          a.a[3][2] = a.a[3][4] = a.a[4][4] = a.a[4][5] = a.a[5][5] = 1;
  a.a[2][2] = a.a[3][3] = 2;
  for (int i = 0; i < 6; i++) b.a[i][i] = 1;
  while (t) {
    if (t & 1) b = b * a;
    a = a * a;
    t /= 2;
  }
  long long x = 0, y = 0;
  for (int i = 0; i < 6; i++) x = (x + b.a[2][i] * c[i]) % n;
  x = (x + n - 1) % n + 1;
  for (int i = 0; i < 6; i++) y = (y + b.a[3][i] * c[i]) % n;
  y = (y + n - 1) % n + 1;
  cout << x << " " << y << endl;
  return 0;
}
