#include using namespace std; using ll = long double; constexpr char newl = '\n'; struct State { int at; ll cost; //int prev; State(int at, ll cost/*, int prev*/) : at(at), cost(cost)/*, prev(prev)*/ {} bool operator>(const State& s) const { return cost > s.cost; } }; struct Edge { int to; ll cost; Edge(int to, ll cost) : to(to), cost(cost) {} }; using Graph = vector< vector >; //隣接リスト const ll INF = 1e15; //const int NONE = -1; //sは始点、mincは最短経路のコスト、prevsは最短経路をたどる際の前の頂点 void dijkstra(int s, const Graph& graph, vector& minc/*, vector& prevs*/){ minc.assign(graph.size(), INF); //prevs.assign(graph.size(), NONE); priority_queue, greater > pq; pq.emplace(s, 0/*, NONE*/); minc[s] = 0; while(!pq.empty()) { State cur = pq.top(); pq.pop(); if (minc[cur.at] < cur.cost) continue; for(const Edge& e : graph[cur.at]) { ll cost = cur.cost + e.cost; if (minc[e.to] <= cost) continue; minc[e.to] = cost; //prevs[e.to] = cur.at; pq.emplace(e.to, cost/*, cur.at*/); } } } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n, m; cin >> n >> m; int x, y; cin >> x >> y; --x; --y; vector p(n), q(n); for (int i = 0; i < n; i++) { cin >> p[i] >> q[i]; } Graph g(n); for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; --u; --v; ll cost = hypot(p[u] - p[v], q[u] - q[v]); g[u].emplace_back(v, cost); g[v].emplace_back(u, cost); } vector minc; dijkstra(x, g, minc); cout << fixed << setprecision(15) << minc[y] << newl; return 0; }