{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eFarmer 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.\u003c/p\u003e\u003cp\u003eThe entire horizon is represented by a number line with \u003ci\u003eN\u003c/i\u003e (1 ≤ \u003ci\u003eN\u003c/i\u003e ≤ 40,000) buildings. Building \u003ci\u003ei\u003c/i\u003e\u0027s silhouette has a base that spans locations \u003ci\u003eA\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e through \u003ci\u003eB\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e along the horizon (1 ≤ \u003ci\u003eA\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e \u0026lt; \u003ci\u003eB\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e ≤ 1,000,000,000) and has height \u003ci\u003eH\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e (1 ≤ \u003ci\u003eH\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e ≤ 1,000,000,000). Determine the area, in square units, of the aggregate silhouette formed by all \u003ci\u003eN\u003c/i\u003e buildings.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Line 1: A single integer: \u003ci\u003eN\u003c/i\u003e\r\u003cbr\u003eLines 2..\u003ci\u003eN\u003c/i\u003e+1: Input line \u003ci\u003ei\u003c/i\u003e+1 describes building \u003ci\u003ei\u003c/i\u003e with three space-separated integers: \u003ci\u003eA\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e, \u003ci\u003eB\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e, and \u003ci\u003eH\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e"}},{"title":"Output","value":{"format":"HTML","content":"Line 1: The total area, in square units, of the silhouettes formed by all \u003ci\u003eN\u003c/i\u003e buildings"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n2 5 1\r\n9 10 4\r\n6 8 2\r\n4 6 3\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e16\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"The first building overlaps with the fourth building for an area of 1 square unit, so the total area is just 3*1 + 1*4 + 2*2 + 2*3 - 1 \u003d 16."}}]}