A, B, C = map(int, input().split()) print(pow(A * B * C, pow(2, int(input()), 10 ** 9 + 6), 10 ** 9 + 7))