#include <bits/stdc++.h>
using namespace std;
long long mod, tt;
int sx, sy, dx, dy;
long long ee[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},
                      {2, 2, 2, 2, 1, 1}, {1, 1, 1, 1, 0, 1}};
struct mat {
  long long a[6][6];
  mat() { memset(a, 0, sizeof(a)); }
  void INIT(void) {
    for (int i = 0; i < (6); i++) a[i][i] = 1;
  }
  void pri(void) {
    for (int i = 0; i < (6); i++) {
      for (int j = 0; j < (6); j++) {
        printf("%I64d ", a[i][j]);
      }
      printf("\n");
    }
  }
};
mat operator+(const mat &a, const mat &b) {
  mat ans;
  for (int i = 0; i < (6); i++) {
    for (int j = 0; j < (6); j++) {
      ans.a[i][j] = a.a[i][j] + b.a[i][j];
      if (ans.a[i][j] >= mod) ans.a[i][j] -= mod;
    }
  }
  return ans;
}
mat operator*(const mat &a, const mat &b) {
  mat ans;
  for (int i = 0; i < (6); i++) {
    for (int j = 0; j < (6); j++) {
      if (a.a[i][j] > 0) {
        for (int k = 0; k < (6); k++) {
          ans.a[i][k] += a.a[i][j] * b.a[j][k];
          if (ans.a[i][k] >= mod) ans.a[i][k] %= mod;
        }
      }
    }
  }
  return ans;
}
mat operator^(mat a, long long n) {
  mat ans;
  ans.INIT();
  while (n) {
    if (n % 2) {
      ans = ans * a;
    }
    a = a * a;
    n /= 2;
  }
  return ans;
}
int main(void) {
  while (cin >> mod >> sx >> sy >> dx >> dy >> tt) {
    mat e;
    memcpy(e.a, ee, sizeof(ee));
    dx = (dx % mod + mod) % mod;
    dy = (dy % mod + mod) % mod;
    mat fuck;
    fuck.a[0][0] = sx - 1;
    fuck.a[0][1] = sy - 1;
    fuck.a[0][2] = dx;
    fuck.a[0][3] = dy;
    fuck.a[0][4] = 1;
    mat ans;
    ans = (e ^ tt);
    ans = fuck * ans;
    printf("%I64d %I64d\n", ans.a[0][0] + 1, ans.a[0][1] + 1);
  }
  return 0;
}
