#include using namespace std; using lint = unsigned long long; const lint inf = 1LL << 60; const lint mod = 1000000007; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); lint a, b, x, n; cin >> a >> b >> x >> n; // for (int i = 0; i < 20; ++i) { // x = (a * x + b) % (1LL << 32); // cout << x << " " << x % 6 + 1 << "\n"; // } lint ta = 0, ao = 0; if (x % 2 == 0) ao = n / 2; else ta = n / 2; cout << ta << " " << ao << "\n"; return 0; }