#include #include #include #include #include #include #include #define in cin #define out cout #define abs(x) ((x>0)?(x):(-(x))) #define max(a, b) (a > b ? a : b) #define min(a, b) (a < b ? a : b) #define FOR(i, a, b) for(int i = a; i <= b; ++i) #define DOWNFOR(i, a, b) for(int i = a; i >= b; --i) #define FOREACH(i, t) for (typeof(t.begin()) i = t.begin(); i != t.end(); ++i) #define ll long long using namespace std; const int Nmax = 500005; int N,M,A,B; vector G[Nmax]; int D[Nmax],inq[Nmax]; queue q; int main(){ #ifndef ONLINE_JUDGE ifstream in("test.in"); ofstream out("test.out"); #endif in>>N>>M>>A>>B; for(int i=1;i<=M;i++){ int x,y; in>>x>>y; G[x].push_back(y); G[y].push_back(x); } for(int i=1;i<=N;i++) D[i]=B; D[1]=0; q.push(1);inq[1]=1; while(!q.empty()){ int x=q.front();q.pop(); inq[x]=1; for(vector::iterator it=G[x].begin();it!=G[x].end();++it){ if(D[x]+A