import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.NoSuchElementException; import java.util.TreeSet; public class Main { public static void main(String[] args) { new Main().run(); } void f(long[][] query,long[] ans) { int N=ans.length; class State implements Comparable { long pos; long height; public State(long pos,long height) { this.pos=pos; this.height=height; } public int compareTo(State o) { return Long.compare(pos, o.pos); }; } TreeSet tree=new TreeSet<>(); tree.add(new State(0, 99999)); tree.add(new State(99999,0)); for (int i=0;i=add.height) continue; while (tree.floor(add).height<=add.height) { State rm=tree.floor(add); tree.remove(rm); ans[i]-=(rm.pos-tree.floor(rm).pos)*(rm.height-tree.ceiling(rm).height); } long gain=(query[i][0]-tree.floor(add).pos)*(query[i][1]-tree.ceiling(add).height); ans[i]+=gain; tree.add(add); } } void run() { FastScanner sc=new FastScanner(); int N=sc.nextInt(); long[] ans=new long[N]; long[][] v1=new long[N][2]; long[][] v2=new long[N][2]; long[][] in=new long[N][2]; for (int i=0;i Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next());} }