import sys INF = float('inf') #10**20,2**63に変えるのもあり MOD = 10**9 + 7 MOD2 = 998244353 def solve(): def II(): return int(sys.stdin.readline()) def CC(): return sys.stdin.readline() def LI(): return list(map(int, sys.stdin.readline().split())) def LC(): return list(input()) def IC(): return [int(c) for c in input()] def MI(): return map(int, sys.stdin.readline().split()) A,B,C = MI() K = II() k = pow(2,K,10**9 + 6) A = pow(A,k,MOD) B = pow(B,k,MOD) C = pow(C,k,MOD) ABC = (A*B*C)%MOD print(ABC % MOD) return solve() #sys.setrecursionlimit(10 ** 6)再帰関数ではコメントにしないこと!!