# Segment Tree - Multiple Update

# City Horizon

Farmer John has taken his cows on a trip to the city! As the sun sets, the cows gaze at the city horizon and observe the beautiful silhouettes formed by the rectangular buildings.

The entire horizon is represented by a number line with **n** (**1** ≤ **n** ≤ **40000**) buildings. Building **i**'s silhouette has a base that spans locations `a`

through _{i}`b`

along the horizon (_{i}**1** ≤ `a`

< _{i}`b`

≤ _{i}`10`

) and has height ^{9}`h`

(_{i}**1** ≤ `h`

≤ _{i}`10`

). Determine the area, in square units, of the aggregate silhouette formed by all ^{9}**n** buildings.

#### Input

First line contains a single integer **n**. Each of the next **n** lines describes building **i** with three space-separated integers: `a`

, _{i}`b`

and _{i}`h`

._{i}

#### Output

Print the total area, in square units, of the silhouettes formed by all **n** buildings.

4 2 5 1 9 10 4 6 8 2 4 6 3

16