#include using namespace std; int main(){ int a,b,c; cin >> a >> b >> c; long long k; cin >> k; int mod=1000000007; k = k % mod; long long ans = (((a*b)%mod)*c)%mod; cout << powl(ans, (k+1)) << endl; }