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; long[] v; long[] lazy; final long INF=Long.MAX_VALUE/3; public Seg(int n_) { while (n