A, B, C = map(int, input().split()) K = int(input()) mod = 10 ** 9 + 7 two = pow(2, K, mod - 1) print(pow(A * B * C, two, mod))