#include <bits/stdc++.h>
using namespace std;
const int matmul[][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}};
long long N, sx, sy, dx, dy, t;
struct matrix {
  int m, n;
  long long d[13][13];
  matrix() {
    m = 0;
    n = 0;
    memset(d, 0, sizeof d);
  }
  matrix(int m, int n) {
    this->m = m;
    this->n = n;
    memset(d, 0, sizeof d);
  }
  matrix operator*(const matrix &a) const {
    int x = m;
    int y = n;
    int z = a.n;
    matrix res = matrix(x, z);
    for (int i = 0; i < (x); i = i + 1)
      for (int j = 0; j < (z); j = j + 1)
        for (int k = 0; k < (y); k = k + 1)
          res.d[i][j] = (res.d[i][j] + d[i][k] * a.d[k][j]) % N;
    return (res);
  }
  matrix operator^(long long k) const {
    matrix res = matrix(m, n);
    matrix mul = (*this);
    for (int i = 0; i < (m); i = i + 1) res.d[i][i] = 1;
    while (k > 0) {
      if (k % 2 == 1) res = res * mul;
      mul = mul * mul;
      k = k >> 1;
    }
    return (res);
  }
  void print(void) const {
    for (int i = 0; i < (m); i = i + 1) {
      for (int j = 0; j < (n); j = j + 1) cout << d[i][j] << " ";
      cout << "\n";
    }
    cout << "\n";
  }
};
matrix fst, mul;
void process(void) {
  cin >> N >> sx >> sy >> dx >> dy >> t;
  if (N == 1) {
    cout << "1 1";
    return;
  }
  fst = matrix(1, 6);
  mul = matrix(6, 6);
  for (int i = 0; i < (6); i = i + 1)
    for (int j = 0; j < (6); j = j + 1) mul.d[i][j] = matmul[i][j] % N;
  fst.d[0][0] = sx - 1;
  fst.d[0][1] = sy - 1;
  fst.d[0][2] = (dx % N + N) % N;
  fst.d[0][3] = (dy % N + N) % N;
  fst.d[0][4] = 0;
  fst.d[0][5] = 1;
  fst = fst * (mul ^ t);
  cout << fst.d[0][0] + 1 << " " << fst.d[0][1] + 1;
}
int main(void) {
  process();
  return 0;
}
