Mission

In an undirected weighted graph, find the shortest simple path from B to H that passes through E.

Medium7GraphShortest pathNo attempts yetTime limit1sMemory limit1024 MB

Problem

Attention, soldier.

I have a special task for you. We have detected an enemy base and it needs to be destroyed. You will be given a map and enough bombs to blow it up. After the action a helicopter will be waiting for you in the forest nearby.

Sounds easy, doesn't it? Find the fastest way to reach the goal, and make sure you do not visit any place twice. Visit a place twice and you will be detected.

Is everything clear? Very well. Get ready, because you are leaving in 10 minutes.

I wish you good luck. Don't get killed, and see you at dinner.

You are given an undirected graph and three different vertices of it: your base, the enemy base, and the place where the helicopter is waiting. Find the shortest path in the graph from your base to the helicopter's place. The path must go through the enemy base and must not visit any vertex twice.

Input

The first line contains five space separated integers NN, MM, BB, EE, HH.

The graph has NN vertices numbered 11 to NN. Your home base is at vertex BB, the enemy base at vertex EE, and the helicopter waits at vertex HH. It holds 1B,E,HN1 \le B, E, H \le N, and BB, EE, HH are pairwise different.

Each of the following MM lines describes one edge with three space separated integers vv, ww, tt (1v,wN1 \le v, w \le N, vwv \ne w, 1t10000001 \le t \le 1000000). It means there is an undirected edge connecting vertices vv and ww, and traversing it costs tt units of time.

No two vertices are connected by more than one edge.

It holds 3N10003 \le N \le 1000 and 0M10000 \le M \le 1000.

Output

Print a single line with a single integer, the least amount of time needed to complete the mission. If the mission cannot be completed, print -1 instead.