import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; import java.util.Stack; class Main { public static void main(String[] $) { new Main().run(); } class Seg { int n=1<<20; long[] v=new long[2*n-1]; long[] lazy=new long[2*n-1]; final long INF=Long.MAX_VALUE/3; void push(int k) { v[k]+=lazy[k]; if (2*k+1