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