Problem: There are N stations in the city where JOI lives, and they are numbered 1, 2, ..., and N, respectively. In addition, there are M railway lines, numbered 1, 2, ..., and M, respectively. The railway line i (1 \ leq i \ leq M) connects station A_i and station B_i in both directions, and the fare is C_i yen.

JOI lives near station S and attends IOI high school near station T. Therefore, I decided to purchase a commuter pass that connects the two. When purchasing a commuter pass, you must specify one route between station S and station T at the lowest fare. With this commuter pass, you can freely get on and off the railway lines included in the specified route in both directions.

JOI also often uses bookstores near Station U and Station V. Therefore, I wanted to purchase a commuter pass so that the fare for traveling from station U to station V would be as small as possible.

When moving from station U to station V, first select one route from station U to station V. The fare to be paid on the railway line i included in this route is

* If railway line i is included in the route specified when purchasing the commuter pass, 0 yen
* If railway line i is not included in the route specified when purchasing the commuter pass, C_i yen



It becomes. The total of these fares is the fare for traveling from station U to station V.

I would like to find the minimum fare for traveling from station U to station V when the route specified when purchasing a commuter pass is selected successfully.

Task

Create a program to find the minimum fare for traveling from station U to station V when you have successfully selected the route you specify when purchasing a commuter pass.

input

Read the following input from standard input.

* Two integers N and M are written on the first line. These indicate that there are N stations and M railroad lines in the city where JOI lives.
* Two integers S and T are written on the second line. These indicate that JOI purchases a commuter pass from station S to station T.
* Two integers U and V are written on the third line. These indicate that JOI wants to minimize the fare for traveling from station U to station V.
* Three integers A_i, B_i, and C_i are written in the i-th line (1 \ leq i \ leq M) of the following M lines. These indicate that the railway line i connects station A_i and station B_i in both directions, and the fare is C_i yen.



output

Output the minimum fare for traveling from station U to station V on one line to the standard output when the route from station S to station T is properly specified when purchasing a commuter pass.

Limits

All input data satisfy the following conditions.

* 2 \ leq N \ leq 100 000.
* 1 \ leq M \ leq 200 000.
* 1 \ leq S \ leq N.
* 1 \ leq T \ leq N.
* 1 \ leq U \ leq N.
* 1 \ leq V \ leq N.
* S ≠ T.
* U ≠ V.
* S ≠ U or T ≠ V.
* You can reach any other station from any station using one or more railway lines.
* 1 \ leq A_i <B_i \ leq N (1 \ leq i l \ leq M).
* 1 For \ leq i <j \ leq M, A_i ≠ A_j or B_i ≠ B_j.
* 1 \ leq C_i \ leq 1 000 000 000 (1 \ leq i \ leq M).



Input / output example

Input example 1


6 6
1 6
14
1 2 1
2 3 1
3 5 1
2 4 3
4 5 2
5 6 1


Output example 1


2


In this input example, the route that can be specified when buying a commuter pass is limited to the route of station 1-> station 2-> station 3-> station 5-> station 6.

To minimize the fare for traveling from station 1 to station 4, choose the route station 1-> station 2-> station 3-> station 5-> station 4. If you choose this route, the fare to be paid on each railway line is

* 2 yen for railway line 5 connecting station 4 and station 5.
* 0 yen for other railway lines.



Therefore, the total fare is 2 yen.

Input example 2


6 5
1 2
3 6
1 2 1000000000
2 3 1000000000
3 4 1000000000
4 5 1000000000
5 6 1000000000


Output example 2


3000000000


In this input example, the commuter pass is not used to move from station 3 to station 6.

Input example 3


8 8
5 7
6 8
1 2 2
2 3 3
3 4 4
1 4 1
1 5 5
2 6 6
3 7 7
4 8 8


Output example 3


15


Input example 4


5 5
1 5
twenty three
1 2 1
2 3 10
2 4 10
3 5 10
4 5 10


Output example 4


0


Input example 5


10 15
6 8
7 9
2 7 12
8 10 17
1 3 1
3 8 14
5 7 15
2 3 7
1 10 14
3 6 12
1 5 10
8 9 1
2 9 7
1 4 1
1 8 1
2 4 7
5 6 16


Output example 5


19





Creative Commons License
Information Olympics Japan Committee work "17th Japan Information Olympics (JOI 2017/2018) Final Selection"





Example

Input

6 6
1 6
1 4
1 2 1
2 3 1
3 5 1
2 4 3
4 5 2
5 6 1


Output

2

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
const ll inf=100000000000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos2{
	int to,from;
	ll cost;
};
struct pos{
	int to;
	ll cost;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<pos> vec[100001];
ll dpV[100001];
ll dpU[100001];
ll dp[100001][4];
int main() {
	int n,m;
	int s,t,u,v;
	cin>>n>>m>>s>>t>>u>>v;

	rep(i,m){
		int a,b;
		ll c;
		cin>>a>>b>>c;
		vec[a].push_back(pos{b,c});
		vec[b].push_back(pos{a,c});
	}
	rep(i,n){
		dpU[i+1]=inf;
		dpV[i+1]=inf;
		dp[i+1][0]=inf;
		dp[i+1][1]=inf;
		dp[i+1][2]=inf;
		dp[i+1][3]=inf;
	}
	auto calc = [](pos2 l,pos2 r){return l.cost > r.cost;};
	priority_queue<pos2,vector<pos2>,decltype(calc)> que(calc);
	que.push(pos2{v,v,0});
	while(!que.empty()){
		pos2 p2=que.top();que.pop();
		if(p2.cost>=dpV[p2.to])continue;
		dpV[p2.to]=p2.cost;
		for(auto it:vec[p2.to]){
			que.push(pos2{it.to,p2.to,p2.cost+it.cost});
		}
	}
	que.push(pos2{u,u,0});
	while(!que.empty()){
		pos2 p2=que.top();que.pop();
		if(p2.cost>=dpU[p2.to])continue;
		dpU[p2.to]=p2.cost;
		for(auto it:vec[p2.to]){
			que.push(pos2{it.to,p2.to,p2.cost+it.cost});
		}
	}
	ll r=dpU[v];

	que.push(pos2{s,s,0});
	while(!que.empty()){
		pos2 p2=que.top();que.pop();
		if(p2.cost>dp[p2.to][0])continue;
		dp[p2.to][1]=min(dp[p2.to][1],min(dp[p2.from][1],dpV[p2.to]));
		dp[p2.to][2]=min(dp[p2.to][2],min(dp[p2.from][2],dpU[p2.to]));
		dp[p2.to][3]=min(min(dp[p2.to][3],dp[p2.from][3]),min(dp[p2.to][1]+dpU[p2.to],dp[p2.to][2]+dpV[p2.to]));
		if(dp[p2.to][0]==p2.cost)continue;
		dp[p2.to][0]=p2.cost;
		for(auto it:vec[p2.to]){
			que.push(pos2{it.to,p2.to,p2.cost+it.cost});
		}
	}


//	rep(i,n)cout<<dpU[i+1]<<endl;
	cout<<min(r,dp[t][3])<<endl;

	return 0;
}