a, b, c = map(int, input().split()) k = int(input()) m = (10**9) + 7 base = (a*b*c)%m exponent = (2**k)%(m-1) print((base**exponent)%m)