A, B, C = map(int, input().split()) K = int(input()) m = 1000000007 print(pow(A * B * C, pow(2, K, m - 1), m))