using System; using System.Linq; using System.Numerics; namespace ABC209_C3 { class Program { static void Main(string[] args) { cin = new input(); mod = new mod(); var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); long A = cin.longreed(); long B = cin.longreed(); long C = cin.longreed(); long K = cin.longreed(); long ans = mod.multiplication(A, B); ans = mod.multiplication(ans, C); K = (long)BigInteger.ModPow(2, K, 1000000006); Console.WriteLine((long)BigInteger.ModPow(ans,K, 1000000007)); Console.Out.Flush(); } static input cin; static mod mod; } class input { string[] soloinput; int t; public input() { soloinput = new string[0]; t = 0; } public string soloreed() { if (t < soloinput.Length) { return soloinput[t++]; } string input = Console.ReadLine(); while (input == "") { input = Console.ReadLine(); } soloinput = input.Split(" "); t = 0; return soloinput[t++]; } public int intreed() { return int.Parse(soloreed()); } public int[] arrayint(int N) { int[] A = new int[N]; for (int i = 0; i < N; i++) { A[i] = intreed(); } return A; } public long longreed() { return long.Parse(soloreed()); } public long[] arraylong(long N) { long[] A = new long[N]; for (long i = 0; i < N; i++) { A[i] = longreed(); } return A; } public decimal decimalreed() { return decimal.Parse(soloreed()); } public decimal[] arraydecimal(long N) { decimal[] A = new decimal[N]; for (decimal i = 0; i < N; i++) { A[(long)i] = decimalreed(); } return A; } } class mod { long T; public mod(long mod = 1000000007) { T = mod; } public long addition(long A, long B) { decimal C = A + B; return (long)C % T; } public long subtraction(long A, long B) { decimal C = A - B; //return (long)Math.Abs(C % A); return C % T >= 0 ? (long)C % T : (long)(C + T) % T; } public long multiplication(long A, long B) { return ((A % T) * (B % T)) % T; } } }