#include <bits/stdc++.h>
using namespace std;
const int d = 6;
long long mat[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}, {0, 0, 0, 0, 1, 1}};
long long MOD, sx, sy, dx, dy, init[d][d];
long long t;
void product(long long m1[d][d], long long m2[d][d]) {
  long long m3[d][d];
  memset(m3, 0, sizeof m3);
  for (long long(i) = 0; (i) <= (d - 1); ++(i))
    for (long long(j) = 0; (j) <= (d - 1); ++(j))
      for (long long(k) = 0; (k) <= (d - 1); ++(k)) {
        m3[i][j] = (1LL * m3[i][j] + 1LL * m1[i][k] * m2[k][j] - 1) % MOD + 1;
        if (m3[i][j] < 0) m3[i][j] += MOD;
      }
  memcpy(m1, m3, sizeof m3);
}
void print(long long mat[d][d]) {
  for (long long(i) = 0; (i) <= (d - 1); ++(i)) {
    for (long long(j) = 0; (j) <= (d - 1); ++(j)) cerr << mat[i][j] << " ";
    cerr << "\n";
  }
  cerr << "\n";
}
void pow(long long put) {
  long long unitate[d][d];
  memset(unitate, 0, sizeof unitate);
  for (long long(i) = 0; (i) <= (d - 1); ++(i)) unitate[i][i] = 1;
  for (int i = 0; (1LL << i) <= put; ++i) {
    if (put & (1LL << i)) product(unitate, mat);
    product(mat, mat);
  }
  memcpy(mat, unitate, sizeof unitate);
}
int main() {
  cin >> MOD >> sx >> sy >> dx >> dy >> t;
  init[0][0] = sx;
  init[0][1] = sy;
  init[0][2] = dx;
  init[0][3] = dy;
  init[0][4] = 0;
  init[0][5] = 1;
  pow(t);
  product(init, mat);
  cout << init[0][0] << " " << init[0][1] << "\n";
  return 0;
}
