#include <bits/stdc++.h>
using namespace std;
int n;
struct Mat {
  int d[6][6];
  Mat() { memset(d, 0, sizeof(d)); }
  friend Mat operator*(Mat a, Mat b) {
    Mat res;
    for (int i = 0; i < 6; ++i) {
      for (int j = 0; j < 6; ++j) {
        for (int k = 0; k < 6; ++k)
          res.d[i][j] += (long long)a.d[i][k] * b.d[k][j] % n, res.d[i][j] %= n;
      }
    }
    return res;
  }
  friend Mat operator^(Mat a, long long k) {
    Mat res;
    for (int i = 0; i < 6; ++i) res.d[i][i] = 1;
    for (; k; k >>= 1, a = a * a)
      if (k & 1) res = res * a;
    return res;
  }
  void out() {
    for (int i = 0; i < 6; ++i) {
      for (int j = 0; j < 6; ++j) printf("%d ", d[i][j]);
      printf("\n");
    }
  }
};
int main() {
  Mat a;
  long long t;
  scanf("%d%d%d%d%d%I64d", &n, &a.d[0][0], &a.d[0][1], &a.d[0][2], &a.d[0][3],
        &t);
  a.d[0][2] = (a.d[0][2] % n + n) % n, a.d[0][3] = (a.d[0][3] % n + n) % n;
  a.d[0][1]--, a.d[0][0]--;
  a.d[0][5] = 1;
  Mat b;
  int w[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}};
  memcpy(b.d, w, sizeof(w));
  a = a * (b ^ t);
  printf("%d %d\n", a.d[0][0] + 1, a.d[0][1] + 1);
  return 0;
}
