#include using namespace std::literals::string_literals; using i64 = std::int_fast64_t; using std::cerr; using std::cin; using std::cout; using std::endl; #if defined(DONLINE_JUDGE) #define NDEBUG #elif defined(ONLINE_JUDGE) #define NDEBUG #endif template std::vector make_v(size_t a) { return std::vector(a); } template auto make_v(size_t a, Ts... ts) { return std::vector(ts...))>(a, make_v(ts...)); } int main() { int n, k, m, p; scanf("%d%d%d%d", &n, &k, &m, &p); std::vector> g(n); for (int i = 0; i < m; ++i) { int a, b; scanf("%d%d", &a, &b); --a; --b; g[a].push_back(b); g[b].push_back(a); } std::vector s(n); for (auto& v : s) scanf("%d", &v); using P = std::pair; // (time, vertex) std::priority_queue, std::greater

> qu; std::vector imm(n, -1); for (int i = 0; i < k; ++i) { int x; scanf("%d", &x); --x; imm[x] = p; qu.push({s[x], x}); } std::vector ban(n, -1); while (!qu.empty()) { const auto [now, v] = qu.top(); qu.pop(); if (ban[v] != -1 and ban[v] < now) continue; for (int to : g[v]) { if (imm[to] == -1) { imm[to] = now + p; } else if (now < imm[to]) { imm[to] = 0; ban[to] = now; continue; } else if (imm[to] <= now) { continue; } qu.push({now + s[to], to}); } } const int ans = std::count(ban.begin(), ban.end(), -1); printf("%d\n", n - ans); return 0; }