#include <bits/stdc++.h>   using namespace std;   template <class T>   void CIN(T &a) {     cin >> a;   }   template <class T>   void CIN(T &a, T &b) {     cin >> a >> b;   }   template <class T>   void CIN(T &a, T &b, T &c) {     cin >> a >> b >> c;   }   template <class T>   void CIN(T &a, T &b, T &c, T &d) {     cin >> a >> b >> c >> d;   }   template <class T>   void PI(T a) {     cout << a << endl;   }   template <class T>   void PI(T a, T b) {     cout << a <<     << b << endl;   }   template <class T>   void PIS(T a) {     cout << a <<    ;   }   template <class T>   T abs(T a) {     return a < 0 ? -a : a;   }   const int N = 10000010;   long long n, x, y, dx, dy, t;   int b[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}};   struct matrix {     long long a[6][6];     matrix() { memset(a, 0, sizeof(a)); }     void init() {       int i, j;       for (i = 0; i < (int)(6); ++i)         for (j = 0; j < (int)(6); ++j) a[i][j] = b[i][j];     }     void unit() {       memset(a, 0, sizeof(a));       int i;       for (i = 0; i < (int)(6); ++i) a[i][i] = 1;     }     matrix operator*(const matrix &b) const {       matrix ret;       int i, j, k;       for (i = 0; i < (int)(6); ++i)         for (j = 0; j < (int)(6); ++j)           for (k = 0; k < (int)(6); ++k) {             ret.a[i][j] += a[i][k] * b.a[k][j];             ret.a[i][j] %= n;           }       return ret;     }     matrix Pow(long long k) {       matrix ret, p = *this;       ret.unit();       while (k) {         if (k & 1) ret = ret * p;         k >>= 1;         p = p * p;       }       return ret;     }   } mx;   int main() {     CIN(n);     CIN(x, y, dx, dy);     CIN(t);     mx.init();     mx = mx.Pow(t);     long long ex = mx.a[0][0] * x + mx.a[0][1] * y + mx.a[0][2] * dx +                    mx.a[0][3] * dy + mx.a[0][5];     long long ey = mx.a[1][0] * x + mx.a[1][1] * y + mx.a[1][2] * dx +                    mx.a[1][3] * dy + mx.a[1][5];     ex %= n;     if (ex <= 0) ex += n;     ey %= n;     if (ey <= 0) ey += n;     PI(ex, ey);     return 0;   }   