#include using namespace std; #define mi (ll)1000000007 #define rep(i,a,b) for(i=a;i=a;i--) #define vi vector #define vl vector #define vvi vector > #define vvii vector > > #define vvil vector > > #define ll long long int #define ld long double #define fi first #define se second #define pb push_back ll paw(ll a,ll b); ll arr[110000],seg[440000]; ll c[110000]; int makeseg(int s,int l,int i) { if (s==l) { seg[i]=arr[s]; return 1; } makeseg( s, ((s+l)/2),((2*i)+1)); makeseg( ((s+l)/2)+1 , l, ((2*i)+2)); seg[i]=(seg[2*i+1]+seg[2*i+2])%mi; return 1; } ll rmq(int ql,int qh,int l,int h,int i) { if (ql<=l&&qh>=h) return seg[i]; if (ql>h||qhh||qi>n>>a>>b>>q; ro=-1*(b/a); px=1; // cout<<"ro "<>c[i]; arr[i]=(((px*c[i])%mi + mi)%mi); px = ((px*ro)%mi + mi)%mi; } makeseg(0,n-1,0); // rep(i,0,n) // cout<>t>>af>>bf; if(t==1) { blah = (bf*paw(px,af))%mi; updateseg(af,0,n-1,0,blah); } else { blah=rmq(0,bf-af,0,n-1,0); // cout<<"blah "<0) { if (b&1) ans=(ans*x)%mi; x=(x*x)%mi; b>>=1; } return ans; }