#C10102. Logistics Minimum Travel Distance

    ID: 39271 Type: Default 1000ms 256MiB

Logistics Minimum Travel Distance

Logistics Minimum Travel Distance

You are given a list of warehouses and a set of delivery tasks. Each task specifies a starting warehouse, a destination warehouse, and the travel distance for that task. Your goal is to calculate the total travel distance for all tasks.

The problem may look simplistic since the actual Euclidean distances between warehouses are not computed; the travel distance for each task is explicitly provided. Mathematically, the total travel distance is given by:

\( S = \sum_{i=1}^{m} d_i \)

where \(d_i\) is the travel distance for the i-th task, and m is the number of tasks.

inputFormat

The input is read from standard input and has the following format:

<n> <m>
x1 y1
x2 y2
... (total n lines representing warehouse coordinates)
si di tdi
si di tdi
... (total m lines representing delivery tasks)

Here, n is the number of warehouses and m is the number of delivery tasks. Each task line contains three integers: the starting warehouse index, the destination warehouse index, and the travel distance.

outputFormat

Output a single integer representing the total travel distance for all delivery tasks, printed to standard output.

## sample
3 3
0 0
2 2
5 5
1 2 3
3 2 2
1 3 4
9

</p>