#include using namespace std; using ll=long long; using ull=unsigned long long; /*#include using namespace atcoder; using mint=modint998244353;*/ #define rep(i, e) for(int i=0; i<(int)(e); ++i) #define dir(dx, dy) for(auto [dx, dy]: vector{pair{1, 0}, {0, 1}, {-1, 0}, {0, -1}}) #define all(v) (v).begin(), (v).end() #define all_r(v) (v).rbegin(), (v).rend() #define in(i) cin >> i #define in_d(type, i) type i; cin >> i #define in_z(i) cin >> i; --i #define in_d_z(type, i) type i; cin >> i; --i #define out(i) cout << (i) << endl #define err(i) cerr << (i) << endl #define out_e() cout << endl #define err_e() cerr << endl #define out_s(i) cout << (i) << " " #define err_s(i) cerr << (i) << " " #define out_f(i) cout << fixed << setprecision(15) << (i) << endl #define err_f(i) cerr << fixed << setprecision(15) << (i) << endl #define out_fs(i) cout << fixed << setprecision(15) << (i) << " " #define err_fs(i) cerr << fixed << setprecision(15) << (i) << " " constexpr int max32=1'000'000'000; constexpr ll max64=1'000'000'000'000'000'000; template bool chmin(T & l, const T & r) { if(r bool chmax(T & l, const T & r) { if(r>l){ l=r; return true; } return false; } int main(void) { in_d(int, a); in_d(int, b); if(b%3==0){ out_s(0); out(a); } else if(b%3==1){ out_s(a); out(0); } else { out_s(-a); out(-a); } return 0; }