#include <bits/stdc++.h>
#define mp make_pair
#define st first
#define nd second
using namespace std;

const int N = 1e5 + 1000;
const int MX = 1e9 + 100;

vector< pair < int, int > > board[N];
vector<int> s[N];
vector<int> a;
int pa[N][22];
int ans[N][22];
bool check[N];
vector<pair<int , pair<int,int> > > k;
int dp[N];
int le[N];
int n;
int m , kk , q;
int dsu[N];

int test(int u)
{
    if( dsu[u] < 0 ) return u;
    return dsu[u] = test( dsu[u] );
}

bool test2(int u , int v)
{
    return test(u) == test(v);
}

void join(int u, int v)
{
    int pau = test(u);
    int pav = test(v);
    if(dsu[pau] > dsu[pav]) swap(pau,pav);
    dsu[pau] += dsu[pav];
    dsu[pav] = pau;
}

void dijkstra()
{
    priority_queue<pair<int,int> , vector<pair<int,int> > , greater < pair<int,int> > > pr;
    for(int x=0; x<a.size(); ++x)
    {
        pr.push(mp( 0, a[x] ));
        dp[a[x]] = 0;
    }
    while(pr.size())
    {
        pair<int,int> u = pr.top(); pr.pop();
        if(check[u.nd]) continue;
        check[u.nd] = 1;
        //cout << u.st << " " << u.nd << endl;
        for(int x=0; x<board[u.nd].size(); ++x)
        {
            pair<int,int> v = board[u.nd][x];
            if( dp[v.st] > v.nd + u.st )
            {
                dp[v.st] = v.nd + u.st;
                pr.push(mp(dp[v.st],v.st));
            }
        }
    }
 //   cout << endl;
}

void dfs(int u , int parent)
{
 //   cout << u <<" " << "n" << endl;
    le[u] = le[parent] + 1;
    pa[u][0] = parent;
    ans[u][0] = min( dp[u] , dp[parent] );
    check[u] = 1;
    for(int x=0; x<s[u].size(); ++x)
    {
        int v = s[u][x];
        if(check[v]) continue;
        dfs(v,u);
    }
}

void LCA()
{
    for(int x=1; x<=20; ++x)
    {
        for(int y=1; y<=n; ++y)
        {
            pa[y][x] = pa[pa[y][x-1]][x-1];
            ans[y][x] = min( ans[pa[y][x-1]][x-1] , ans[y][x-1] );
        }
    }
}

int lca(int u, int v)
{
    int an = min(dp[u],dp[v]);
    if(le[u] < le[v] ) swap(u,v);
    for(int x=20; x>=0; --x) if( le[pa[u][x]] >= le[v] ) { an = min( an , ans[u][x] );  u = pa[u][x]; }
   // cout << an << " " <<  u << " " << v << endl;
    for(int x=20; x>=0; --x) if( pa[u][x] != pa[v][x] ) { an = min( an , ans[u][x] ); an = min(an , ans[v][x]); u = pa[u][x]; v = pa[v][x]; }
   // cout << an << " " << u << " " << v << endl;
    while(u != v)
    {
        an = min( an , ans[u][0] );
        an = min( an , ans[v][0] );
        u = pa[u][0];
        v = pa[v][0];
    }
    return an;
}

int main()
{
  //  freopen("test.inp","r",stdin);
    cin >> n >>m >> kk >> q;
    for(int x=0; x<N; ++x)
        dp[x] = MX;
    for(int x=0; x<m; ++x)
    {
        int u,v,l;
        cin >> u >> v >> l;
        board[u].push_back(mp(v,l));
        board[v].push_back(mp(u,l));
        k.push_back( mp( l , mp( u, v )  ) );
      //  cout << u << " " << v << " " << l << endl;
    }
    for(int x=0; x<kk; ++x)
    {
        int u;
        cin >> u;
     //   cout << u << endl;
        a.push_back(u);
    }
    dijkstra();

  //  for(int x=1; x<=n; ++x) cout << dp[x] << " l" << endl;

    for(int x=0; x<N; ++x) dsu[x] = -1;

    for(int x=0;  x<k.size(); ++x)
    {
        k[x].st = min( dp[k[x].nd.st] , dp[k[x].nd.nd] );
    }

    sort(k.begin(), k.end());

    for(int x=k.size() - 1 ; x >= 0; --x)
    {
        if(test2( k[x].nd.st , k[x].nd.nd ) ) continue;
        join( k[x].nd.st , k[x].nd.nd );
        s[k[x].nd.st].push_back(k[x].nd.nd);
        s[k[x].nd.nd].push_back(k[x].nd.st);
     //   cout << k[x].nd.st << " " << k[x].nd.nd << " " << k[x].st << " su" << endl;
    }
    for(int x=0; x<N; ++x) check[x] = 0;
    for(int x=0; x<N; ++x) for(int y=0; y<=20; ++y) ans[x][y] = MX;
    dfs(1,1);
   // for(int x=1; x<=n; ++x)  { cout << ans[x][0] << " " << le[x] << endl; }
    LCA();

    for(int x=0; x<q; ++x)
    {
        int u , v;
        cin >> u >> v;
      //  cout << u << " " << v << " n" << endl;
        cout << lca(u,v) << endl;
    }
}

Measured memory_bytes: 36104