#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read(T x) {
  int f = 1;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') f = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 1) + (x << 3) + ch - '0';
  return x * f;
}
const int N = 6;
int n;
const int A[6][6] = {
    {2, 1, 1, 1, 0, 0}, {1, 2, 1, 1, 0, 0}, {1, 0, 1, 0, 0, 0},
    {0, 1, 0, 1, 0, 0}, {1, 1, 1, 1, 1, 0}, {2, 2, 2, 2, 1, 1},
};
struct Matrix {
  int V[N][N];
  Matrix() { memset(V, 0, sizeof(V)); }
  void clear() { memset(V, 0, sizeof(V)); }
  void init() {
    clear();
    for (int i = 0; i < N; i++) V[i][i] = 1;
  }
};
Matrix operator*(Matrix x, Matrix y) {
  Matrix z;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++)
      for (int k = 0; k < N; k++)
        z.V[i][k] = (1ll * x.V[i][j] * y.V[j][k] + z.V[i][k]) % n;
  return z;
}
Matrix mlt(Matrix a, long long b) {
  Matrix res;
  res.init();
  for (; b; b >>= 1, a = a * a)
    if (b & 1) res = res * a;
  return res;
}
int main() {
  n = read(0);
  Matrix Ans, Trans;
  int sx = read(0), sy = read(0), dx = read(0), dy = read(0);
  long long t = read(0ll);
  Ans.V[0][0] = sx - 1, Ans.V[0][1] = sy - 1;
  Ans.V[0][2] = dx, Ans.V[0][3] = dy, Ans.V[0][5] = 1;
  memcpy(Trans.V, A, sizeof(A));
  Ans = Ans * mlt(Trans, t);
  printf("%d %d\n", (Ans.V[0][0] + n) % n + 1, (Ans.V[0][1] + n) % n + 1);
  return 0;
}
