a,b,c=map(int,input().split()) k=int(input()) M=10**9+7 if k%2: a,b,c=b*c,c*a,a*b k-=1 print(pow(a*b*c,pow(4,k//2,M-1),M))