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