import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long[] x = new long[7];
		x[0] = sc.nextLong();
		long n = sc.nextLong();
		sc.close();

		long m = 1L << 32;
		for (int i = 1; i < x.length; i++) {
			x[i] = toBI(a).multiply(toBI(x[i - 1])).mod(toBI(m)).longValue();
			x[i] += b;
			x[i] %= m;
		}
		for (int i = 1; i < x.length; i++) {
			x[i]++;
		}

		if (x[1] % 2 == 1) {
			System.out.println(n / 2 + " 0");
		} else {
			System.out.println("0 " + n / 2);
		}
	}

	static BigInteger toBI(long x) {
		return BigInteger.valueOf(x);
	}
}