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