#include"bits/stdc++.h" using namespace std; #define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++) #define rep(i,n) REP((i),0,(n)) using ll = long long; using pii = pair; using pll = pair; using tp3 = tuple; using Mat = vector>; constexpr int INF = 1 << 28; constexpr ll INFL = 1ll << 60; constexpr int dh[4] = { 0,1,0,-1 }; constexpr int dw[4] = { -1,0,1,0 }; bool isin(const int H, const int W, const int h, const int w) { return 0 <= h && h < H && 0 <= w && w < W; } // ============ template finished ============ using pdd = pair; using pdi = pair; double dist(const vector& pq, const int from, const int to) { pdd d = { pq[to].first - pq[from].first,pq[to].second - pq[from].second }; return sqrt(d.first*d.first + d.second*d.second); } int main() { int N, M, X, Y; cin >> N >> M >> X >> Y; X--; Y--; vector poss(N); vector> edges(N); rep(i, N)cin >> poss[i].first >> poss[i].second; rep(i, M) { int P, Q; cin >> P >> Q; P--; Q--; edges[P].push_back(Q); edges[Q].push_back(P); } vector ds(N, INFL); priority_queue, greater> pq; ds[X] = 0; pq.push({ 0,X }); while (!pq.empty()) { double d; int now; tie(d, now) = pq.top(); pq.pop(); for (auto next : edges[now]) { double nd = d + dist(poss, now, next); if (nd < ds[next]) { ds[next] = nd; pq.push({ nd,next }); } } } cout << fixed << setprecision(12) << ds[Y] << endl; return 0; }