#include <bits/stdc++.h>
#define N 100005
#define A first
#define B second
#define MAX 1000000005
using namespace std;
typedef pair<int, int> ii;
typedef vector<ii> vii;
vii adjList[N];
priority_queue<ii,vii, greater<ii> > Q;
int dist[N];
bool checkpoint[N], finish[N], visited[N];
void run_djikstras(){
int u=0, v=0, w=0;
memset(visited,false,sizeof visited);
for(int i=0;i<N;i++) dist[i]=MAX;
Q.push(make_pair(0,0));
while(!Q.empty()){
u=Q.top().B;
w=Q.top().A;
Q.pop();
visited[u]=true;
if(dist[u]>w) dist[u]=w;
for(int i=0;i<(int)adjList[u].size();i++){
v=adjList[u][i].B;
if(dist[v]>dist[u]+adjList[u][i].A) dist[v]=dist[u]+adjList[u][i].A;
if(!visited[v]){
visited[v]=true;
Q.push(make_pair(dist[v],v));
}
}
}
}
int main(){
//cout<<MAX<<endl;
memset(checkpoint, false, sizeof(checkpoint));
memset(finish, false, sizeof(finish));
int n, m, c, f, temp, u, v, w;
cin>>n>>m>>c>>f;
for(int i=0;i<c;i++){
cin>>temp;
checkpoint[temp]=true;
}
for(int i=0;i<f;i++){
cin>>temp;
finish[temp]=true;
}
for(int i=0;i<m;i++){
cin>>u>>v>>w;
adjList[u].push_back(make_pair(w, v));
}
run_djikstras(); //gets all the shortest distances in the array dist[]
int ans=MAX, best=MAX;
for(int i=0;i<=n;i++)
if(finish[i]) best = min(best, dist[i]); //best is the shortest distance from 0 to a finish node directly connected to it.
for(int i=0;i<=n;i++){
if(checkpoint[i]){
for(int j=0;j<(int)adjList[i].size();j++){
if(adjList[i][j].B==0) ans = min(ans, dist[i] + best); //if 0 is connected
if(finish[adjList[i][j].B]) ans = min(ans, dist[i] + adjList[i][j].A); //if a finishing point is connected
}
}
}
if(ans==MAX) cout<<"-1"<<endl;
else cout<<ans<<endl;
//system("pause");
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgTiAxMDAwMDUKI2RlZmluZSBBIGZpcnN0CiNkZWZpbmUgQiBzZWNvb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