#include #include #include #include #include #include #include #include #include #include #include #include #define MOD 1000000007LL using namespace std; typedef long long int ll; typedef pair P; long long int powmod(long long int a, long long int k, long long int m){ if(a==0){ return 0; } long long int apow[35]; for(int i=0; i<35; i++){ if(i==0){ apow[i]=a; }else{ apow[i]=apow[i-1]*apow[i-1]%m; } } long long int ans=1; for(int i=34; i>=0; i--){ if(k>=(1ll<=0; i--){ if(k>=(1ll<>n>>m; ll iv2=500000004; P p1=pow5(iv2, iv2, m), p2=pow5(iv2, MOD-iv2, m); ll a1=p1.first, a2=p1.second, b1=p2.first, b2=p2.second; P p3=inv5(a1-1, a2), p4=inv5(b1-1, b2); P p5=pow5(a1, a2, n), p6=pow5(b1, b2, n); P p7=mul(a1, a2, p3.first, p3.second), p8=mul(b1, b2, p4.first, p4.second); P p9=mul(p7.first, p7.second, p5.first-1, p5.second), p10=mul(p8.first, p8.second, p6.first-1, p6.second); cout<<(p9.second-p10.second+MOD)%MOD<