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