#include #define syosu(x) fixed< P; typedef pair pdd; typedef pair pll; typedef vector vi; typedef vector vvi; typedef vector vd; typedef vector vvd; typedef vector vl; typedef vector vvl; typedef vector vs; typedef vector

vp; typedef vector vvp; typedef vector vpll; typedef pair pip; typedef vector vip; const int inf=1<<30; const ll INF=1ll<<60; const double pi=acos(-1); const double eps=1e-8; const ull mod=1e9+7; const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1}; template class Lazy_Segment_Tree{ private: int n; vector date,lazy; void Set_Lazy(int k,T x){ date[k]+=x; lazy[k]+=x; } void Push(int k){ Set_Lazy(k*2+1,lazy[k]); Set_Lazy(k*2+2,lazy[k]); lazy[k]=0; } void Fix(int k){ date[k]=max(date[k*2+1],date[k*2+2]); } void Add_func(int a,int b,int k,int l,int r,T x){ if(r<=a||b<=l) return; if(a<=l&&r<=b){ Set_Lazy(k,x); return; } Push(k); int m=(l+r)/2; Add_func(a,b,k*2+1,l,m,x); Add_func(a,b,k*2+2,m,r,x); Fix(k); } void Update_func(int I,int k,int l,int r,T x){ if(r<=I||I(2*n-1,-INF); } void Add(int a,int b,T x){ Add_func(a,b,0,0,n,x); } void Update(int k,T x){ Update_func(k,0,0,n,x); } T Query(int a,int b){ return Query_func(a,b,0,0,n); } }; ll n,m; int main(){ cin>>n; Lazy_Segment_Tree st(n); for(int i=0;i>A; st.Update(i,A-3*i); } cin>>m; for(int i=0;i<1;i++){ int l,r,A; cin>>l>>r>>A; st.Add(l-1,r,A); cout<<3*n+st.Query(0,n-1)-3<