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