a, b, c = map(int, input().split()) k = int(input()) MOD = 10**9 + 7 kk = pow(2, k, MOD - 1) print(pow(a * b * c % MOD, kk, MOD))