#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //cout << fixed << setprecision(15) << << endl; #include #include //#include "atcoder/all" using namespace std; //using namespace atcoder; #define ll long long int #define pb push_back #define rep(i,n) for(int i=0;i<(n);i++) #define REP(i,n) for(int i=1;i<=(n);i++) //#define P pair int mx8[] = {0,0,1,-1,-1,1,-1,1}; int my8[] = {-1,1,0,0,-1,-1,1,1}; int mx4[] = {1,-1,0,0}; int my4[] = {0,0,-1,1}; template class Graph { public: struct Edge { int to; T cost; }; struct edge { int from; int to; }; vector> g; int n; Graph(int n) { g.resize(n); } void Add(int from, int to, T cost) { g[from].push_back({to,cost}); g[to].push_back({from,cost}); } }; template vector dijkstra(Graph G, int start) { using P = pair; vector dist(G.n, numeric_limits::max()); priority_queue,greater

> pq; dist[start] = 0; pq.push({dist[start],start}); while(!pq.empty()) { T COST = pq.top().first; int v = pq.top().second; pq.pop(); if(dist[v] < COST) { continue; } for(auto e : G.g[v]) { int j = e.to; T c = e.cost; if(dist[j] > dist[v] + c) { dist[j] = dist[v] + c; pq.push({dist[j],j}); } } } return dist; } int main(){ int n, m, x, y; cin >> n >> m >> x >> y; --x; --y; vector p(n),q(n); rep(i,n) cin >> p[i] >> q[i]; Graph G(n); rep(i,m){ int P, Q; cin >> P >> Q; P--; Q--; double Co = sqrt(pow((p[P]-p[Q]),2) + pow((q[P]-q[Q]),2)); G.Add(P,Q,Co); } vector ans; ans = dijkstra(G,x); cout << fixed << setprecision(10) << ans[y] << endl; }