import sys input = sys.stdin.readline A, B, C = map(int, input().split()) K = int(input()) mod = 10 ** 9 + 7 print(pow(A * B * C, pow(2, K, mod - 1), mod))