P = 10 ** 9 + 7 A, B, C = map(int, input().split()) x = A * B % P * C % P K = int(input()) y = pow(2, K, P - 1) print(pow(x, y, P))