#include <bits/stdc++.h>
using namespace std;
long long mod;
const int N = 10;
struct matrix {
  long long x[N + 1][N + 1];
  matrix() { memset(x, 0, sizeof(x)); }
  matrix(long long init) {
    memset(x, 0, sizeof(x));
    for (int i = 1; i <= N; i++) x[i][i] = init;
  }
  matrix operator+(matrix that) {
    matrix ret;
    for (int i = 1; i <= N; i++)
      for (int j = 1; j <= N; j++) ret.x[i][j] = (x[i][j] + that.x[i][j]) % mod;
    return ret;
  }
  matrix operator-(matrix that) {
    matrix ret;
    for (int i = 1; i <= N; i++)
      for (int j = 1; j <= N; j++)
        ret.x[i][j] = (x[i][j] - that.x[i][j] + mod) % mod;
    return ret;
  }
  matrix operator*(matrix that) {
    matrix ret;
    for (int i = 1; i <= N; i++)
      for (int j = 1; j <= N; j++)
        for (int k = 1; k <= N; k++)
          ret.x[i][j] = (ret.x[i][j] + x[i][k] * that.x[k][j]) % mod;
    return ret;
  }
} I(1);
matrix power(matrix b, long long e) {
  matrix ret = I;
  while (e) {
    if (e & 1) ret = ret * b;
    b = b * b;
    e /= 2;
  }
  return ret;
}
int MAIN() {
  matrix init, trans;
  long long x, y, dx, dy, t;
  cin >> mod >> x >> y >> dx >> dy >> t;
  init.x[1][1] = 1;
  init.x[2][1] = 0;
  init.x[3][1] = dx;
  init.x[4][1] = dy;
  init.x[5][1] = x;
  init.x[6][1] = y;
  trans.x[1][1] = 1;
  trans.x[2][1] = 1;
  trans.x[2][2] = 1;
  trans.x[3][2] = 1;
  trans.x[3][3] = 1;
  trans.x[3][5] = 1;
  trans.x[3][6] = 1;
  trans.x[4][2] = 1;
  trans.x[4][4] = 1;
  trans.x[4][5] = 1;
  trans.x[4][6] = 1;
  trans.x[5][2] = 1;
  trans.x[5][3] = 1;
  trans.x[5][5] = 2;
  trans.x[5][6] = 1;
  trans.x[6][2] = 1;
  trans.x[6][4] = 1;
  trans.x[6][5] = 1;
  trans.x[6][6] = 2;
  matrix r = power(trans, t) * init;
  x = r.x[5][1];
  y = r.x[6][1];
  x %= mod;
  x += mod;
  x %= mod;
  y %= mod;
  y += mod;
  y %= mod;
  if (x == 0) x = mod;
  if (y == 0) y = mod;
  cout << x << " " << y << endl;
  return 0;
}
int main() {
  ios ::sync_with_stdio(false);
  cout << fixed << setprecision(16);
  return MAIN();
}
