#include <bits/stdc++.h>
using namespace std;
const int N = 123;
int n, sx, sy, dx, dy, M;
long long t;
struct matrix {
  int n, m;
  long long a[N][N];
  matrix() {
    n = m = 0;
    memset(a, 0, sizeof a);
  }
  matrix operator*(matrix b) {
    matrix res;
    res.n = n, res.m = b.m;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= res.m; j++)
        for (int k = 1; k <= m; k++)
          res.a[i][j] = (res.a[i][j] + (a[i][k] * b.a[k][j]) % M) % M;
    return res;
  }
};
matrix a, b;
matrix bp(matrix a, long long n) {
  matrix res;
  res.n = a.n, res.m = a.m;
  for (int i = 1; i <= res.n; i++) res.a[i][i] = 1;
  while (n) {
    if (n & 1) res = res * a;
    a = a * a;
    n >>= 1;
  }
  return res;
}
int tmp[6][6] = {1, 0, 0, 0, 0, 0, 0, 2, 1, 1, 0, 1, 0, 1, 2, 0, 1, 1,
                 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1};
void out(matrix x) {
  for (int i = 1; i <= x.n; i++) {
    for (int j = 1; j <= x.m; j++) printf("%d ", x.a[i][j]);
    printf("\n");
  }
}
int main() {
  cin >> M >> sx >> sy >> dx >> dy >> t;
  a.n = a.m = 6;
  for (int i = 1; i <= 6; i++)
    for (int j = 1; j <= 6; j++) a.a[i][j] = tmp[i - 1][j - 1];
  b.n = 6;
  b.m = 1;
  b.a[1][1] = 1, b.a[2][1] = sx, b.a[3][1] = sy, b.a[4][1] = dx, b.a[5][1] = dy,
  b.a[6][1] = 0;
  a = bp(a, t);
  b = (a * b);
  if (b.a[2][1] <= 0) b.a[2][1] += M;
  if (b.a[3][1] <= 0) b.a[3][1] += M;
  cout << b.a[2][1] << " " << b.a[3][1];
  return 0;
}
