The first line has the number of vertices n and the number of edges m. (2≤n≤5000, 1≤m≤100000)
Each of the next m lines has three integers a, b, c, meaning the graph has an edge of weight c between vertex a and vertex b. (1≤a,b≤n, 1≤c≤100, a=b)
The last line has two vertices s and t. (1≤s,t≤n, s=t)
The edge list may hold more than one edge between the same pair of vertices. At the start s and t are always connected.