#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

ll N,M,K,Q;
vector<P> G[100005];
vector<P> G2[100005];
ll dist[100005];

ll uni_par[100005];
ll uni_rank[100005];

ll lca_par[20][100005];
ll lca_par_cost[20][100005];
ll lca_depth[100005];

void init(ll n){
    for (int i = 0;i < n;i++){
        uni_par[i] = i;
        uni_rank[i] = 0;
    }
}

int find(int x){
    if(uni_par[x] == x){
        return x;
    }else{
        return uni_par[x] = find(uni_par[x]);
    }
}

void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(uni_rank[x] < uni_rank[y]){
        uni_par[x] = y;
    }else{
        uni_par[y] = x;
        if(uni_rank[x] == uni_rank[y]) uni_rank[x]++;
    }
}

bool same(int x, int y){
    return find(x) == find(y);
}

void dfs(int v, int p, int d){
    lca_par[0][v] = p;
    if(p == -1) lca_par_cost[0][v] = dist[v];
    else lca_par_cost[0][v] = min(dist[v],dist[p]);
    lca_depth[v] = d;
    for (int i = 0;i < G2[v].size();i++){
        if(G2[v][i].first != p) dfs(G2[v][i].first,v,d+1);
    }
}

void init_lca(int V){
    dfs(1,-1,0);
    for (int k = 0;k+1 < 20;k++){
        for (int v = 1;v <= V;v++){
            if(lca_par[k][v] < 0){ 
                lca_par[k+1][v] = -1;
                lca_par_cost[k+1][v] = INT_MAX;
            }else{
                //cout << lca_par[k][v] << endl;
                lca_par[k+1][v] = lca_par[k][lca_par[k][v]];
                lca_par_cost[k+1][v] = min(lca_par_cost[k][v],lca_par_cost[k][lca_par[k][v]]);
            }
        }
    }
}

int lca(int u, int v){
    if(lca_depth[u] > lca_depth[v]) swap(u,v);
    ll cost_u = dist[u];
    //cout << u << " " << cost_u << " ";
    ll cost_v = dist[v];
    for (int k = 0;k < 20;k++){
        if((lca_depth[v]-lca_depth[u]) >> k & 1){
            cost_v = min(cost_v,lca_par_cost[k][v]);
            v = lca_par[k][v];
        }
    }
    if(u == v) return min(cost_u,cost_v);
    for (int k = 19;k >= 0;k--){
        if(lca_par[k][u] != lca_par[k][v]){
            cost_u = min(cost_u,lca_par_cost[k][u]);
            u = lca_par[k][u];
            cost_v = min(cost_v,lca_par_cost[k][v]);
            v = lca_par[k][v];
        }
    }
    cost_u = min(cost_u,lca_par_cost[0][u]);
    cost_v = min(cost_v,lca_par_cost[0][v]);
    return min(cost_u,cost_v);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N >> M >> K >> Q;
    for (int i = 0;i < M;i++){
        ll A,B,L; cin >> A >> B >> L;
        G[A].push_back(P(B,L));
        G[B].push_back(P(A,L));
    }

    priority_queue<P,vector<P>,greater<P> > que;

    for (int i = 0;i <= N;i++){
        dist[i] = LLONG_MAX;
    }

    for (int i = 0;i < K;i++){
        ll F; cin >> F;
        que.push(P(0,F));
        dist[F] = 0;
    }

    while(que.size()){
        P p = que.top(); que.pop();
        ll from = p.second;
        ll sum = p.first;
        if(sum > dist[from]) continue;
        //cout << dist[from] << endl;
        for (int i = 0;i < G[from].size();i++){
            ll to = G[from][i].first;
            ll cost = G[from][i].second;
            if(sum+cost < dist[to]){
                dist[to] = sum+cost;
                que.push(P(dist[to],to));
            }
        }
    }

    //cout << "sdfas" << endl;

    init(N);
    vector<pair<ll,P>> pp;
    for (int i = 1;i <= N;i++){
        for (int j = 0;j < G[i].size();j++){
            pp.push_back({min(dist[i],dist[G[i][j].first]),P(i,G[i][j].first)});
            //cout << i << " " << G[i][j].first << " " << min(dist[i],dist[G[i][j].first]) << endl;
        }
    }
    sort(pp.begin(),pp.end());
    reverse(pp.begin(),pp.end());
    ll idx = -1;
    for (int i = 0;i < N-1;i++){
        ll from,to,cost;
        do{
            idx++;
            from = pp[idx].second.first;
            to = pp[idx].second.second;
            cost = pp[idx].first;
        }while(same(from,to));
        G2[from].push_back(P(to,cost));
        G2[to].push_back(P(from,cost));
        //cout << from << " " << to << " " << cost << endl;
        unite(from,to);
    }
    //cout << "sdfas" << endl;

    init_lca(N);
    //cout << "sdfas" << endl;

    for (int i = 0;i < Q;i++){
        int u,v; cin >> u >> v;
        cout << lca(u,v) << endl;
    }

    return 0;

}


Measured memory_bytes: 66844