#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <limits>
using namespace std;
struct Node;
typedef pair<int, Node*> Edge; // weight and target node
struct Node
{
bool isFlooded;
bool dijkstraMark;
int value;
typedef vector<Edge> EdgeList;
EdgeList adjacentNodes;
Node():
isFlooded( true ),
dijkstraMark( false ),
value( numeric_limits<int>::max() )
{}
};
typedef vector<Node> AdjacencyList;
struct NodeComparer
{
bool operator()(const Node& n1, const Node& n2)
{
return (n1.value) >= (n2.value);
}
};
void solve( AdjacencyList& graph, Node* currentNode )
{
currentNode->dijkstraMark = true;
int adjacentSize = currentNode->adjacentNodes.size();
for( int i=0; i < adjacentSize; i++ )
{
Edge& edge = currentNode->adjacentNodes[i];
if(( currentNode->isFlooded &&
(currentNode->value + edge.first ) > 20 )
||
( edge.first > 20 ) )
{
edge.second->value = numeric_limits<int>::max();
}
// the node is valid
else if(( currentNode->value + edge.first ) < edge.second->value )
{
edge.second->value = currentNode->value + edge.first;
}
}
int pos = -1;
int minValue = numeric_limits<int>::max();
for( size_t i=0; i < graph.size(); i++ )
{
if( !graph[i].dijkstraMark && graph[i].value <= minValue )
{
pos = i;
minValue = graph[i].value;
}
}
if( pos != -1 )
{
solve( graph, &graph[pos] );
}
}
int main()
{
istream& in = cin;
int nodes, edges, goalNode, emptyNodes;
in >> nodes >> edges >> goalNode >> emptyNodes;
AdjacencyList graph( nodes );
for( int i=0; i < emptyNodes; i++ )
{
int nodeId;
in >> nodeId;
graph[nodeId-1].isFlooded = false;
}
for( int i=0; i < edges; i++ )
{
int firstEdge, secondEdge, weight;
in >> firstEdge >> secondEdge >> weight;
graph[firstEdge-1].adjacentNodes.push_back( make_pair( weight, &graph[secondEdge-1] ));
graph[secondEdge-1].adjacentNodes.push_back( make_pair( weight, &graph[firstEdge-1] ));
}
graph[0].value = 0;
solve( graph, &graph[0] );
ostream& out = cout;
if( graph[goalNode-1].value == numeric_limits<int>::max() )
{
graph[goalNode-1].value = -1;
}
out << graph[goalNode-1].value;
return 0;
}