p, q, r = (int(x) for x in (input().split())) k = int(input()) l = (2**k) % 1000000007 res = (p*q*r) ** (l) print(res % 1000000007)