传送门
欧拉降幂板子题,第一次见这个东西
const ll mod=1e9+7; ll fib[maxn],a,b,n,m; int main(){ a=read,b=read,m=read,n=read; fib[1]=fib[2]=1; for(int i=3;i<=n;i++) fib[i]=(a*fib[i-1]+b*fib[i-2])%(mod-1); cout<<ksm(m,fib[n],mod)<<endl; return 0; }