#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); long long A,B; cin >> A >> B; if(B == 0) cout << 0 << " " << A << endl; else if(B == 1) cout << A << " " << 0 << endl; else{ B %= 3; if(B == 0) cout << 0 << " " << A << endl; else if(B == 1) cout << A << " " << 0 << endl; else if(B == 2) cout << -A << " " << -A << endl; } }