#include using namespace std; template struct LazySegTree{ //0-indexed 閉区間 using F=function; using G=function; using H=function; using P=function; int size; vector data; vector lazy; const F f; //要素同士の演算 const G g; //要素と作用素のマージ const H h; //作用素同士のマージ const P p; //作用素を下に降ろす const Monoid M1; //単位元 const OperatorMonoid OM0; //作用素の単位元 LazySegTree(int n,const F f,const G g,const H h,const P p,const Monoid &M1,const OperatorMonoid OM0) :f(f),g(g),h(h),p(p),M1(M1),OM0(OM0){ size=1; while(size=0;k--){ data[k]=f(data[2*k+1],data[2*k+2]); } } void propagate(int k,int len){ //長さlenのkから下へ伝播 if(lazy[k]!=OM0){ if(k=r){ //内部 lazy[k]=h(lazy[k],x); propagate(k,r-l+1); return data[k]; }else{ return data[k]=f(update(a,b,x,2*k+1,l,(l+r)/2), update(a,b,x,2*k+2,(l+r)/2+1,r)); } } Monoid update(int a,int b,const OperatorMonoid &x){ //[a,b]をxに変更 return update(a,b,x,0,0,size-1); } Monoid query(int a,int b,int k,int l,int r){ propagate(k,r-l+1); if(r=r){ return data[k]; }else{ return f(query(a,b,2*k+1,l,(l+r)/2), query(a,b,2*k+2,(l+r)/2+1,r)); } } Monoid query(int a,int b){ return query(a,b,0,0,size-1); } Monoid operator[](const int &k){ return query(k,k); } void debug(){ for(int i=0;i=0;i--) #define all(vec) vec.begin(),vec.end() using vi=vector; using vvi=vector; using vl=vector; using vvl=vector; using P=pair; using PP=pair; using vp=vector

; using vpp=vector; using vs=vector; #define fi first #define se second #define pb push_back templatebool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} const ll MOD=1000000007LL; const int INF=1<<30; const ll LINF=1LL<<60; int main(){ int n; cin>>n; n--; auto f=[](ll a,ll b){return max(a,b);}; auto g=[](ll a,ll b){return a+b;}; auto p=[](ll a,ll b){return a;}; LazySegTree tr(n,f,g,g,p,0,0); REP(i,n){ ll x; cin>>x; tr.set(i,x+(n-i)*3); } tr.build(); int m; cin>>m; REP(i,m){ int l,r;ll d; cin>>l>>r>>d; l--;r--; tr.update(l,r,d); cout<