Given an undirected graph where each edge has an associated cost, your task is to determine the value of the global maximum cut.
The first line of the input contains two integers, and , representing the number of vertices and edges in the graph, respectively (2 \leq n \leq 1000, 1 \leq m \leq 30000). The following lines each describe an edge with three integers , , and , indicating that there is an edge between vertices and with a cost of (0 \leq c \leq 10^9).
Print the value of the global maximum cut.
Example 1