import sys
input = sys.stdin.readline  # "\n"を含む

def solve(A, B, C, K):

    mod = 10 ** 9 + 7

    P = (A * B * C) % mod
    K = pow(2, K, mod-1)

    return pow(P, K, mod)

def main():
    A, B, C = map(int, input().split())
    K = int(input())
    res = solve(A, B, C, K)
    print(res)

if __name__ == "__main__":
    main()