#include #include #include #include #include #include #include #include #include static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template constexpr T INF = ::numeric_limits::max()/32*15+208; template struct edge { int from, to; T cost; edge(int to, T cost) : from(-1), to(to), cost(cost) {} edge(int from, int to, T cost) : from(from), to(to), cost(cost) {} }; template vector dijkstra(int s,vector>> &G){ auto n = G.size(); vector d(n, INF); priority_queue,vector>,greater<>> Q; d[s] = 0; Q.emplace(0, s); while(!Q.empty()){ T cost; int i; tie(cost, i) = Q.top(); Q.pop(); if(d[i] < cost) continue; for (auto &&e : G[i]) { auto cost2 = cost + e.cost; if(d[e.to] <= cost2) continue; d[e.to] = cost2; Q.emplace(d[e.to], e.to); } } return d; } int main() { int n, m, x, y; cin >> n >> m >> x >> y; x--; y--; vector p(n), q(n); for (int i = 0; i < n; ++i) { scanf("%d %d", &p[i], &q[i]); } vector>> G(n); for (int i = 0; i < m; ++i) { int a, b; scanf("%d %d", &a, &b); a--; b--; G[a].emplace_back(b, hypot(p[a]-p[b], q[a]-q[b])); G[b].emplace_back(a, hypot(p[a]-p[b], q[a]-q[b])); } printf("%.10lf\n", dijkstra(x, G)[y]); return 0; }