Enter an integeron the first line.
The second line isintegers
, separated by spaces.
In the nextline, each line contains three integers
, indicating that there is a railway connecting cities
and
with a length of
kilometers.
Output one line, including an integer, which means the minimum toll.Ensure that the answer range does not exceed the long long type.