#include <bits/stdc++.h>
long long mod, sx, sy, dx, dy, t;
struct mal {
  long long D[6][6];
  void clear() { memset(D, 0, sizeof(D)); }
};
long long base[][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}, {0, 0, 0, 0, 1, 1}};
mal carp(mal X, mal Y) {
  mal ret;
  ret.clear();
  for (int i = 0; i < 6; i++)
    for (int j = 0; j < 6; j++)
      for (int k = 0; k < 6; k++) {
        ret.D[i][j] += X.D[i][k] * Y.D[k][j];
        ret.D[i][j] %= mod;
      }
  return ret;
}
mal binpow(mal A, long long B) {
  if (B == 1) return A;
  if (B & 1) return carp(A, binpow(A, B - 1));
  mal tmp = binpow(A, B / 2);
  return carp(tmp, tmp);
}
int main() {
  scanf("%I64d %I64d %I64d %I64d %I64d %I64d", &mod, &sx, &sy, &dx, &dy, &t);
  if (t == 0) {
    printf("%I64d %I64d", sx, sy);
    return 0;
  }
  dx = (dx % mod + mod) % mod, dy = (dy % mod + mod) % mod;
  mal X, Y;
  memcpy(X.D, base, sizeof(X.D));
  X = binpow(X, t);
  Y.clear();
  Y.D[0][0] = sx, Y.D[0][1] = sy, Y.D[0][2] = dx, Y.D[0][3] = dy, Y.D[0][5] = 1;
  Y = carp(Y, X);
  long long nx = Y.D[0][0], ny = Y.D[0][1];
  printf("%I64d %I64d\n", (!nx ? mod : nx), (!ny ? mod : ny));
}
