a, b, c = map(int, input().split()) k = int(input()) mod = 10**9+7 x = (a*b*c)%mod if x == 0: print(0) exit() y = pow(2, k, mod-1) ans = pow(x, y, mod) print(ans)