#include namespace nono { enum class EventType { RECOVER = 0, INFECT = 1, INFECTED = 2, }; enum class State { FINE, RECOVER, INFECTED, GOODBYE, }; struct Event { long long time; EventType type; int index; Event(long long time, EventType type, int index): time(time), type(type), index(index) {} friend auto operator<=>(const Event& lhs, const Event& rhs) = default; }; void solve() { int N, K, M, P; std::cin >> N >> K >> M >> P; std::vector graph(N, std::vector()); for (int i = 0; i < M; i++) { int u, v; std::cin >> u >> v; u--; v--; graph[u].push_back(v); graph[v].push_back(u); } std::vector S(N); for (int i = 0; i < N; i++) std::cin >> S[i]; std::priority_queue, std::greater> events; for (int i = 0; i < K; i++) { int x; std::cin >> x; x--; events.emplace(0, EventType::INFECTED, x); } std::vector states(N, State::FINE); while (not events.empty()) { auto [now, type, i] = events.top(); events.pop(); if (states[i] == State::GOODBYE) continue; if (type == EventType::RECOVER) { if (states[i] == State::GOODBYE) continue; states[i] = State::RECOVER; } else if (type == EventType::INFECT) { for (int to: graph[i]) { if (states[to] == State::FINE or states[to] == State::INFECTED) { events.emplace(now, EventType::INFECTED, to); } } } else if (type == EventType::INFECTED) { if (states[i] == State::FINE) { states[i] = State::INFECTED; events.emplace(now + S[i], EventType::INFECT, i); events.emplace(now + P, EventType::RECOVER, i); } else if (states[i] == State::INFECTED) { states[i] = State::GOODBYE; } } } int ans = 0; for (int i = 0; i < N; i++) { if (states[i] == State::GOODBYE) ans++; // if (states[i] == State::GOODBYE) { // std::cout << "GOODBYE" << ' '; // } else if (states[i] == State::FINE) { // std::cout << "FINE" << ' '; // } else if (states[i] == State::INFECTED) { // std::cout << "INFECTED" << ' '; // } else { // std::cout << "RECOVER" << ' '; // } } // std::cout << std::endl; std::cout << ans << std::endl; } } // namespace nono int main() { std::cin.tie(0)->sync_with_stdio(0); std::cout << std::fixed << std::setprecision(15); int t = 1; // std::cin >> t; while (t--) nono::solve(); }