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