ll@t; rep(t){ ll@n,@a[n],b[n],c[n],s,t,z; b[0]=c[0]=s=a[0]; rep(i,1,n){ s+=a[i]; b[i]=max(b[i-1],s); c[i]=min(c[i-1],s); } z=t=s; rrep(i,n){ z>?=b[i]*2-s*2+t; z>?=-c[i]*2+s*2-t; s-=a[i]; } wt(z); }