#include #define int long long using namespace std; const int N=1000010; const int mod=998244353; int n,q; int a[N]; int l,r,x; struct SegmentTree{ int t[N<<2]; int lazy[N<<2]; int ls(int p){return p<<1;} int rs(int p){return p<<1|1;} void push_up(int p){ t[p]=max(t[ls(p)],t[rs(p)]); return; } void build(int l,int r,int p){ if(l==r){ t[p]=a[l]+(n-l+1)*3; return; } int mid=(l+r)>>1; build(l,mid,ls(p)); build(mid+1,r,rs(p)); push_up(p); return; } void addlazy(int p,int x){ t[p]+=x; lazy[p]+=x; return; } void push_down(int p){ if(!lazy[p])return; addlazy(ls(p),lazy[p]); addlazy(rs(p),lazy[p]); lazy[p]=0; return; } void update(int L,int R,int x,int l,int r,int p){ if(L<=l&&r<=R){ addlazy(p,x); return; } push_down(p); int mid=(l+r)>>1; if(L<=mid)update(L,R,x,l,mid,ls(p)); if(R>mid)update(L,R,x,mid+1,r,rs(p)); push_up(p); return; } // int query(int L,int R,int l,int r,int p){ // if(L<=l&&r<=R)return t[p]; // push_down(p); // int mid=(l+r)>>1; // int res=0; // if(L<=mid)res=max(res,query(L,R,l,mid,ls(p))); // if(R>mid)res=max(res,query(L,R,mid+1,r,rs(p))); // push_up(p); // return res; // } }T; signed main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("onduty.in","r",stdin); // freopen("onduty.out","w",stdout); cin>>n; n--; for(int i=1;i<=n;i++)cin>>a[i]; T.build(1,n,1); cin>>q; while(q--){ cin>>l>>r>>x; T.update(l,r,x,1,n,1); cout<