Magical Bridges
A magician lives in a country which consists of N islands and M bridges. Some of the bridges are magical bridges, which are created by the magician. Her magic can change all the lengths of the magical bridges to the same non-negative integer simultaneously.
This country has a famous 2-player race game. Player 1 starts from island S_1 and Player 2 starts from island S_2. A player who reached the island T first is a winner.
Since the magician loves to watch this game, she decided to make the game most exiting by changing the length of the magical bridges so that the difference between the shortest-path distance from S_1 to T and the shortest-path distance from S_2 to T is as small as possible. We ignore the movement inside the islands.
Your job is to calculate how small the gap can be.
Note that she assigns a length of the magical bridges before the race starts once, and does not change the lengthduring the race.
Input
The input consists of several datasets. The end of the input is denoted by ve zeros separated by a single-space. Each dataset obeys the following format. Every number in the inputs is integer.
N M S_1 S_2 T
a_1 b_1 w_1
a_2 b_2 w_2
...
a_M b_M w_M
(a_i, b_i) indicates the bridge i connects the two islands a_i and b_i.
w_i is either a non-negative integer or a letter 'x' (quotes for clarity). If w_i is an integer, it indicates the bridge i is normal and its length is w_i. Otherwise, it indicates the bridge i is magical.
You can assume the following:
1 ≤ N ≤ 1000
1 ≤ M ≤ 2000
1 ≤ S_1, S_2, T ≤ N
S_1, S_2, T are all different.
1 ≤ a_i, b_i ≤ N
a_i ≠ b_i
For all normal bridge i, 0 ≤ w_i ≤ 1000000000
The number of magical bridges ≤ 100
Output
For each dataset, print the answer in a line.