#include <bits/stdc++.h>
using namespace std;
struct matrix {
  long long v[7][7];
};
matrix bin, ans;
long long mod, x, y, sp_x, sp_y, t;
matrix mult(matrix a, matrix b) {
  matrix temp;
  for (int i = 0; i < 6; i++)
    for (int j = 0; j < 6; j++) {
      temp.v[i][j] = 0;
      for (int k = 0; k < 6; k++)
        temp.v[i][j] = (temp.v[i][j] + a.v[i][k] * b.v[k][j] - 1) % mod + 1;
    }
  return temp;
}
matrix quick(matrix a, matrix b, long long n) {
  while (n) {
    if (n & 1) a = mult(a, b);
    b = mult(b, b);
    n >>= 1;
  }
  return a;
}
void init() {
  memset(ans.v, 0, sizeof(ans.v));
  ans.v[0][0] = x;
  ans.v[0][1] = y;
  ans.v[0][2] = sp_x;
  ans.v[0][3] = sp_y;
  ans.v[0][4] = 0;
  ans.v[0][5] = 1;
  memset(bin.v, 0, sizeof(bin.v));
  for (int i = 0; i < 4; i++) bin.v[0][i] = bin.v[1][i] = 1;
  bin.v[0][0] = bin.v[1][1] = 2;
  bin.v[2][0] = bin.v[2][2] = 1;
  bin.v[3][1] = bin.v[3][3] = 1;
  bin.v[5][5] = bin.v[5][4] = 1;
  for (int i = 0; i < 5; i++) bin.v[4][i] = 1;
}
int main() {
  cin >> mod >> x >> y >> sp_x >> sp_y >> t;
  init();
  ans = quick(ans, bin, t);
  cout << (ans.v[0][0] % mod - 1 + mod) % mod + 1 << " "
       << (ans.v[0][1] % mod - 1 + mod) % mod + 1 << endl;
  return 0;
}
