a, b, x, n = map(int, input().split()) print(*[n//2, 0][::-1**(x%2)])