There's a beach inthefirst quadrant. And fromtimetotime, there are sea waves.
A wave ( x , y ) means the wave is a rectangle whose vertexes are ( 0 , 0 ), ( x ,
0 ), ( 0 , y ), ( x , y ). Every timethe wave will wash out the trace of former
wave inits range and remain its own trace of ( x , 0 ) -> ( x , y ) and ( 0 , y )
-> ( x , y ). Now the toad onthe coast wants to know the total lengthof trace onthe coast after n waves. It's guaranteed that a wave will not cover the other
completely.
【Input】
The first line isthenumberof waves n(n≤50000)n(n < 50000)n(n≤50000).
The next nnn lines,each contains two numbers x y ,( 0<x0 < x0<x , y≤10000000y <
10000000y≤10000000 ),the i-th line means the i-th second there comes a wave of ( x
, y ), it's guaranteed that when 1≤i1 < i1≤i , j≤nj < nj≤n ,xi≤xjx_i < x_jxi≤xj
and yi≤yjy_i < y_jyi≤yj don't set up atthe same time.