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