#include "bits/stdc++.h" using namespace std; template vector Dijkstra(vector > > Graph, long long Start) { using PT = pair; const Type Inf = numeric_limits::max(); long long Size = Graph.size(); vector Dist; Dist.assign(Size, Inf); priority_queue, greater > PQ; Dist[Start] = 0; PQ.emplace(PT(Dist[Start], Start)); while (!PQ.empty()) { PT p = PQ.top(); PQ.pop(); Type D = p.first; long long E = p.second; if (Dist[E] < D) continue; for (pair Next : Graph[E]) { Type ND = Next.second; long long NE = Next.first; if (Dist[NE] > Dist[E] + ND) { Dist[NE] = Dist[E] + ND; PQ.emplace(PT(Dist[NE], NE)); } } } return Dist; } int main() { int N, M, X, Y; cin >> N >> M >> X >> Y; X--, Y--; vector > P(N); vector > > V(N); for (int i = 0; i < N; i++) { cin >> P[i].first >> P[i].second; } for (int i = 0; i < M; i++) { int S, T; cin >> S >> T; S--, T--; double D = (P[S].first - P[T].first) * (P[S].first - P[T].first) + (P[S].second - P[T].second) * (P[S].second - P[T].second); D = sqrt(D); V[S].push_back({ T, D }); V[T].push_back({ S, D }); } vector Dist = Dijkstra(V, X); printf("%.12lf\n", Dist[Y]); }