During the war the king of the Northern Kingdom once drew up a plan to attack the Southern Kingdom. The territory of the two countries is described by p points and w roads. Every road is bidirectional, and each road has a width, so the number of soldiers that can pass along it is proportional to that width.
The king believed that soldiers are stronger when they move together, so he fixed one route to the Southern Kingdom in advance and sent every soldier along that route only. The king was shrewd, so he chose the route whose narrowest road is as wide as possible.
The record of which route he used burned during the war. The war history cannot be finished without it. You are a great scientist, so recover it.
The first line contains the number of points p and the number of roads w, separated by a space. (2≤p≤1000, 1≤w≤50000)
The second line contains the capital of the Northern Kingdom c and the capital of the Southern Kingdom v, separated by a space. (0≤c,v<p, c=v)
Each of the next w lines contains the two points wstart and wend that a road connects, followed by the width of that road wwidth, separated by spaces. (0≤wstart,wend<p, wstart=wend, 1≤wwidth≤1000)
Several roads may connect the same pair of points. At least one route from c to v exists.
Print on the first line the width of the narrowest road on the route the king chose.