#include<bits/stdc++.h> using namespace std; using ll = long long; using V = vector<ll>; using M = vector<V>; M mult(M a,M b){ M res(a.size(),V(b[0].size(),0)); for(int i=0;i<a.size();++i){ for(int j=0;j<b[0].size();++j){ for(int k=0;k<a[0].size();++k){ res[i][j] += a[i][k] * b[k][j]; } } } return res; } int main(){ ll a; ll b; cin >> a >> b; vector<int> xs(3,0); M state(3,V(1,0)); state[2][0] = a; M r(3,V(3,0)); M l(3,V(3,0)); r[0][1] = 1; r[1][2] = 1; l[1][1] = 1; l[2][2] = 1; l[1][0] = -1; l[2][0] = -1; M m = mult(l,r); while(b > 0){ if(b % 2 == 1){ state = mult(m, state); } m = mult(m,m); b /= 2; } cout << state[1][0] << " " << state[2][0] << endl; }