#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<double,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;


int n = 200005;
int m;
vector<vector<pll>> graph(n,vector<pll>());

vector<double>  Dijkstra(int start){
    vector<bool> seen(n,false);
    vector<double> shortest(n,LINF);
    priority_queue<pll,vector<pll>,greater<pll>> pq;
    pq.push(pll(0.0,start));

    while(!pq.empty()){
        double dist = pq.top().first;
        int node = pq.top().second;
        pq.pop();
        if(seen[node]) continue;

        shortest[node] = dist;
        seen[node] = true;

        for(pll next:graph[node]){
            int next_node = next.second;
            double next_cost = next.first;
            if(seen[next_node]) continue;
            pq.push(pll(next_cost + dist,next_node));
        }
    }

    return shortest;
}

int main(){
    cin >> n >> m;
    int x,y;
    cin >> x >> y;
    --x;--y;
    vector<pair<double,double>> pq(n);
    rep(i,n) cin >> pq[i].first >> pq[i].second;

    rep(i,m){
        int p,q;
        cin >> p >> q;
        --p;--q;
        double dis = sqrt((pq[p].first - pq[q].first)*(pq[p].first - pq[q].first) + (pq[p].second-pq[q].second)*(pq[p].second-pq[q].second));
        graph[p].push_back(pll(dis,q));
        graph[q].push_back(pll(dis,p));
    }

    vector<double> ans = Dijkstra(x);

    cout << setprecision(20) << ans[y] << endl;

    return 0;
}