A, B, C = map(int,input().split()) K = int(input()) x = A * B * C #for _ in range(K): # x = x * x % 1000000007 #print(A * B * C % 1000000007) k = pow(2, K, 10 ** 9 + 6) print(pow(x, k, 10 ** 9 + 7))