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