mod = 10**9+7 a, b, c = map(int, input().split()) K = int(input()) L = pow(2, K, mod-1) print(pow(a*b*c, L, mod))