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