#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 1e9 + 10; const ll INFL = 4e18; #include <atcoder/convolution> int main() { ll A, B; cin >> A >> B; if (A == 0) { cout << 0 << ' ' << 0 << endl; return 0; } if (B % 3 == 0) { cout << 0 << ' ' << A << endl; } else if (B % 3 == 1) { cout << A << ' ' << 0 << endl; } else { cout << -A << ' ' << -A << endl; } }