#K14446. Optimized Delivery Truck Route
Optimized Delivery Truck Route
Optimized Delivery Truck Route
You are given a simulation of a delivery service where a single truck starts its journey at the warehouse located at ((0, 0)). The truck must process (N) delivery requests. For each request, regardless of the delivery type, the truck travels from the warehouse to the specified destination ((x, y)) and then returns directly back to the warehouse. The distance for each delivery is computed using the Manhattan distance, which is defined as ( |x_1 - x_2| + |y_1 - y_2| ). Therefore, for a single delivery, the distance adds up to: [ \text{Distance} = 2 \times (|x| + |y|)] Your task is to compute the total distance traveled for all deliveries.
inputFormat
The input is read from standard input (stdin). The first line contains a single integer (N), representing the number of delivery requests. Each of the following (N) lines contains three space-separated integers: (t), (x), and (y). The integer (t) represents the delivery type but does not affect the distance calculation. The coordinates ((x, y)) specify the delivery destination.
outputFormat
Print a single integer to standard output (stdout), which is the total distance traveled by the truck after processing all deliveries.## sample
1
1 3 4
14
</p>