#include #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; using namespace std; const int MOD = 1e9 + 7; ll pow(ll a, ll b, int m) { ll ans = 1; while (b) { if (b % 2 == 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans; } int main() { ll A, B, C, K; cin >> A >> B >> C >> K; int r = pow(2, K, MOD - 1); if (r == 0) r = MOD - 1; ll ans = pow(A, r, MOD) * pow(B, r, MOD) % MOD * pow(C, r, MOD) % MOD; cout << ans << endl; return 0; }