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