#ifdef NACHIA #define _GLIBCXX_DEBUG #else #define NDEBUG #endif #include #include #include #include using i64 = long long; using u64 = unsigned long long; #define rep(i,n) for(int i=0; i void chmin(A& l, const A& r){ if(r < l) l = r; } template void chmax(A& l, const A& r){ if(l < r) l = r; } using namespace std; void testcase(){ i64 a,b; cin >> a >> b; if(b >= 3){ b = (b - 3) % 3 + 3; } i64 x0 = a, x1 = 0; rep(i,b){ i64 x2 = x1; x1 = x0; x0 = 0; x1 -= x2; x0 -= x2; } cout << x1 << " " << x0 << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); testcase(); return 0; }