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