#include #include #include #include #include //#include using namespace std; //using mint=atcoder::modint998244353; int N,K,M,P; vectorG[1<<17]; int S[1<<17]; int inf[1<<17]; bool ban[1<<17]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N>>K>>M>>P; for(int i=0;i>u>>v; u--,v--; G[u].push_back(v); G[v].push_back(u); } for(int i=0;i>S[i]; inf[i]=-1; } priority_queue,vector >,greater > >Q; for(int i=0;i>x;x--; inf[x]=0; Q.push(make_pair(inf[x]+S[x],x)); } int bc=0; while(!Q.empty()) { int d=Q.top().first; while(!Q.empty()&&Q.top().first==d) { int x=Q.top().second; Q.pop(); if(ban[x]) { continue; } for(int v:G[x]) { if(inf[v]==-1) { inf[v]=d; Q.push(make_pair(inf[v]+S[v],v)); } else if(inf[v]+P>d) { bc+=!ban[v]; ban[v]=true; } } } } cout<