Problem B
Avoiding Your Boss
Input: standard input
Output: standard output
Time Limit: 4 seconds
Memory Limit: 32 MB

 

Imagine that like me you are also an idle but reasonably good programmer. On one fine morning you wake up from sleep and discover that your bed is such a lovely place and you must not leave it for the miserable place called office. So you just pick up your mobile phone, call your boss with a gloomy voice and tell him that you are quite sick. Your boss is a very strict but sympathetic person and so he grants you leave via phone. As the day grows old you discover that you must go out for shopping. But you are afraid that your boss might see you. So you need to know if there is any safe option to reach the market. You know that your boss stays only in two places, his residence and the office. While going from one place to another he uses a path that does not cost more than any other path. So you must avoid such paths and even places that your boss may reach. Your boss must not see you outside your home. You can assume that the cost of reaching another location in the same place is zero and you must go outside your home to reach market and your boss must come outside to reach home (from office) or office (from home). As your job is at stake so you cannot take any chances.

 

Input

The input file contains several sets of input. Each set of input starts with six integers P, R, BH, OF, YH and M. Here

 

                P = Total number of places. (0<P<=100)

                R = Total number of connecting roads. (0<=R<=4950)

                BH = The Place where your boss lives. (0<BH<=P)

                OF = The place where your office is situated. (0<OF<=P)

                YH = The place where your home is situated. (0<YH<=P)

                M = The place where the market is situated. (0<M<=P)

               

Next R lines contain description of the city. Each line contains three integers p1, p2 and d. These three integers denote that place p1 and place p2 is connected by a road whose cost is d. Here (0<p1, p2<=P) and d is a positive integer less than 101. Streets are all bi-directional. You can assume that two different places are connected by only one road. Input is terminated by end of file.

 

Output

For each set of input produce one line of output. This line contains the cost of going from your home to the market. If it is not possible for you to go to the market avoiding your boss print the line MISSION IMPOSSIBLE.’ (Without the quotes).

 

Sample Input
3 2 2 3 1 3

1 2 4

2 3 4

3 2 2 3 3 3

1 2 4

2 3 4

4 3 2 3 1 4

1 2 4

2 3 4

1 4 10


Sample Output
MISSION IMPOSSIBLE.

MISSION IMPOSSIBLE.

10


Shahriar Manzoor