#include #include #include using namespace std; int main( void ) { int N, K, M, P; cin >> N >> K >> M >> P; vector> Graph( N ); int u, v; for( int i = 0; i < M; i++ ) { cin >> u >> v; u--, v--; Graph[u].push_back( v ); Graph[v].push_back( u ); } vector S( N ); for( int i = 0; i < N; i++ ) { cin >> S[i]; } vector invasion_day( N, -1 ), qua_day( N, -1 ); vector status( N, 0 ); priority_queue, vector>, greater>> q; int x; for( int i = 0; i < K; i++ ) { cin >> x, x--; q.push( make_pair( S[x], x ) ); invasion_day[x] = 0; status[x] = 1; } pair cur; int ans = 0; while( !q.empty() ) { cur = q.top(), q.pop(); if( status[cur.second] == 2 && qua_day[cur.second] != cur.first ) continue; for( int next : Graph[cur.second] ) { if( status[next] == 2 ) continue; if( status[next] == 0 ) { q.push( make_pair( cur.first + S[next], next ) ); invasion_day[next] = cur.first; status[next] = 1; } else { if( invasion_day[next] + P > cur.first ) { ans++; status[next] = 2; qua_day[next] = cur.first; } } } } cout << ans << endl; return 0; }