#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<string>
#include<queue>
#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<int> G[Nmax];
int D[Nmax],inq[Nmax];
queue<int> 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<int>::iterator it=G[x].begin();it!=G[x].end();++it){
            if(D[x]+A<D[*it]){
                D[*it]=D[x]+A;
                if(!inq[*it]){
                    q.push(*it);inq[*it]=1;
                }
            }
        }
    }
    out<<D[N];
    return 0;
}