MOD=10**9+7 a,b,c=map(int,input().split()) k=int(input()) r=(a*b*c)%MOD print(pow(r,pow(2,k,MOD-1),MOD))