This class is on art. Mr. Picasso gives every baby a piece of white drawing paper and let them paint on it.
Baby Volcano is going to color the drawing paper black. For convenience, the drawing paper can be regarded as a Cartesian coordinate system, and initially, all points on it is white.
Baby Volcano plans to paint the drawing paper in $n$ steps. In the $i$th step, he will color rectangular $R_i$ black, where the lower left corner of $R_i$ is $(l_i,0)$, the upper right corner of $R_i$ is $(r_i,h_i)$.
Let $P_i$ be the drawing paper after the first $i$ steps, your task is to calculate the perimeter of black area on $P_i$.