#include <bits/stdc++.h>
using namespace std;
long long int MOD;
long long int mod(long long int a) {
  a %= MOD;
  if (a < 0) a += MOD;
  return a;
}
struct matrix {
  int n, m;
  long long int a[6][6];
  matrix() {}
  matrix(int n_, int m_) {
    n = n_, m = m_;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) a[i][j] = 0;
  }
  matrix operator*(const matrix &t) {
    int p = t.m;
    matrix res(n, p);
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < p; j++) {
        for (int k = 0; k < m; k++) {
          long long int v = mod(1ll * a[i][k] * t.a[k][j]);
          res.a[i][j] = mod(res.a[i][j] + v);
        }
      }
    }
    return res;
  }
  void print() {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) printf("%d ", a[i][j]);
      printf("\n");
    }
    printf("\n");
  }
};
matrix fpow(matrix a, long long int n) {
  matrix ans(6, 6);
  for (int i = 0; i < 6; i++) ans.a[i][i] = 1;
  while (n > 0) {
    if (n & 1) ans = ans * a;
    a = a * a;
    n >>= 1;
  }
  return ans;
}
int ar[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 main() {
  int x, y, dx, dy;
  long long int t;
  scanf("%d%d%d%d%d%lld", &MOD, &x, &y, &dx, &dy, &t);
  matrix m(6, 6), v(6, 1);
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 6; j++) m.a[i][j] = ar[i][j];
  }
  v.a[0][0] = x, v.a[1][0] = y, v.a[2][0] = dx, v.a[3][0] = dy, v.a[5][0] = 1;
  matrix sol = fpow(m, t - 1) * v;
  long long int sum = mod(sol.a[0][0] + sol.a[1][0]);
  sum = mod(sum + t - 1);
  dx = mod(sol.a[2][0] + sum);
  dy = mod(sol.a[3][0] + sum);
  x = mod(sol.a[0][0] + dx - 1) + 1;
  y = mod(sol.a[1][0] + dy - 1) + 1;
  printf("%d %d", x, y);
  return 0;
}
