#include // clang-format off using Int = long long; #define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++) #define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__) struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io; #ifndef dump #define dump(...) #endif // clang-format on /** * author: knshnb * created: Fri May 29 22:12:23 JST 2020 **/ template struct Dijkstra { struct Edge { int to; T cost; }; std::vector> g; Dijkstra(int n) : g(n) {} void add_edge(int u, int v, T cost) { g[u].push_back({v, cost}); if (!directed) g[v].push_back({u, cost}); } std::vector run(int s) { std::vector dist(g.size(), std::numeric_limits::max() / 2); // {d, v} std::priority_queue, std::vector>, std::greater>> q; q.push({0, s}); while (!q.empty()) { std::pair p = q.top(); q.pop(); int v = p.second; if (dist[v] <= p.first) continue; dist[v] = p.first; for (const Edge& e : g[v]) { if (dist[e.to] <= p.first + e.cost) continue; // 定数倍枝刈り q.emplace(p.first + e.cost, e.to); } } return dist; } }; signed main() { Int n, m, x, y; std::cin >> n >> m >> x >> y; x--, y--; Dijkstra g(n); std::vector p(n), q(n); REP(i, n) std::cin >> p[i] >> q[i]; REP(i, m) { Int u, v; std::cin >> u >> v; u--, v--; double dx = p[u] - p[v], dy = q[u] - q[v]; g.add_edge(u, v, sqrt(dx * dx + dy * dy)); } std::cout << g.run(x)[y] << std::endl; }