import sys input = sys.stdin.readline A,B,C=map(int,input().split()) X=A*B*C K=int(input()) mod=10**9+7 u=pow(2,K,mod-1) print(pow(X,u,mod))