MOD = 10**9+7 a,b,c = map(int,input().split()) K = int(input()) m = pow(2,K,MOD-1) ans = pow(a*b*c,m,MOD) print(ans)