#include <bits/stdc++.h>
using namespace std;
const int M[6][6] = {{2, 1, 1, 0, 1, 0}, {1, 2, 0, 1, 1, 0},
                     {1, 1, 1, 0, 1, 0}, {1, 1, 0, 1, 1, 0},
                     {0, 0, 0, 0, 1, 1}, {0, 0, 0, 0, 0, 1}};
int sx, sy, dx, dy;
long long n, t;
vector<vector<long long> > mult(vector<vector<long long> > A,
                                vector<vector<long long> > B) {
  vector<vector<long long> > res(6, vector<long long>(6, 0ll));
  for (int i = 0; i < (6); i++)
    for (int j = 0; j < (6); j++)
      for (int k = 0; k < (6); k++)
        res[i][j] = (res[i][j] + A[i][k] * B[k][j]) % n;
  return res;
}
vector<vector<long long> > power(vector<vector<long long> > A, long long k) {
  if (!k) {
    vector<vector<long long> > res(6, vector<long long>(6, 0ll));
    for (int i = 0; i < (6); i++) res[i][i] = 1ll;
    return res;
  }
  vector<vector<long long> > res = power(A, k / 2);
  res = mult(res, res);
  if (k & 1)
    return mult(A, res);
  else
    return res;
}
int main() {
  cin >> n >> sx >> sy >> dx >> dy >> t;
  vector<vector<long long> > m(6, vector<long long>(6));
  for (int i = 0; i < (6); i++)
    for (int j = 0; j < (6); j++) m[i][j] = (long long)M[i][j];
  vector<vector<long long> > res = power(m, t);
  int start[6] = {sx, sy, dx, dy, 0, 1};
  long long ans[2] = {0ll, 0ll};
  for (int i = 0; i < (2); i++) {
    for (int j = 0; j < (6); j++) ans[i] += res[i][j] * start[j];
    ans[i] %= n;
    if (ans[i] <= 0) ans[i] += n;
  }
  cout << ans[0] << " " << ans[1] << "\n";
  return 0;
}
