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