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