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