#include using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); unsigned long long int a, b, x, n; cin >> a >> b >> x >> n; unsigned long long int x0 = a * x; x0 %= (1LL << 32); x0 += b; x0 %= (1LL << 32); x0 %= 6; x0 += 1; if (x0 % 2 == 1) { cout << n / 2 << ' ' << 0 << '\n'; } else { cout << 0 << ' ' << n / 2 << '\n'; } return 0; }