void main(){ import std.stdio, std.string, std.conv, std.algorithm; int n; rd(n); auto t=readln.split.to!(long[]); assert(t.length==(n-1)); auto sqd=new SqD(t); int q; rd(q); while(q--){ int l, r; long d; rd(l, r, d); sqd.radd(l-1, r, d); writeln(sqd.rmax(0, n-1)); } } class SqD{ int sz=1, k=1; long[] buc, bucmax, laz; import std.algorithm; this(long[] a){ auto n=a.length; while(sz*sz0){ buc[(i*sz)..((i+1)*sz)]+=laz[i]; laz[i]=0; } } void radd(int l, int r, long x){ for(auto i=l/sz; i<=r/sz && i*sz