A, B, C = map(int, input().split()) K = int(input()) mod = int(1e9 + 7) ans = pow(A * B * C % mod, pow(2, K, mod - 1), mod) print(ans)