The first line contains the number of vertices n and the number of edges in the list m. (2≤n≤5000, 1≤m≤100000)
Each of the next m lines contains three integers a, b, c, meaning the list holds an edge of weight c between vertex a and vertex b. (1≤a,b≤n, 1≤c≤100, a=b)
The last line contains the two vertices s and t. (1≤s,t≤n, s=t)
The list may hold several edges between the same pair of vertices. Adding every edge of the list is guaranteed to make the graph connected.