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