#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; vector edges; int n; Graph(int n) :n(n) { g.resize(n); } void Add(int from, int to, T cost) { g[from].push_back({to, cost}); g[to].push_back({from, cost}); } void Add_Edge(int from, int to) { edges.push_back({from, to}); } }; template vector dijkstra(const 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 expected = pq.top().first; int i = pq.top().second; pq.pop(); if (dist[i] != expected) { continue; } for (auto e : g.g[i]) { int j = e.to; T c = e.cost; if (dist[j] > dist[i] + c) { dist[j] = dist[i] + c; pq.push({dist[j], j}); } } } return dist; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); 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 dist = dijkstra(G, x); cout << fixed << setprecision(17) << dist[y] << '\n'; return 0; }