#include <bits/stdc++.h>

using namespace std;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    fast_io();
    long long a, b;
    cin >> a >> b;
    if (b % 3 == 0) {
        cout << 0 << " " << a << "\n";
    } else if (b % 3 == 1) {
        cout << a << " " << 0 << "\n";
    } else {
        cout << -a << " " << -a << "\n";
    }
}