#include<bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<n;i++) #define all(A) A.begin(),A.end() int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll A,B; cin>>A>>B; B%=3; if(B==0){ cout<<0<<" "<<A<<endl; } else if(B==1){ cout<<A<<" "<<0<<endl; } else{ cout<<-A<<" "<<-A<<endl; } }