#include using namespace std; int main() { int n, m, x, y; cin >> n >> m >> x >> y; x--; y--; vector a(n), b(n); for (int i = 0; i < n; i++) { cin >> a.at(i) >> b.at(i); } vector>> to(n); for (int i = 0; i < m; i++) { int p, q; cin >> p >> q; p--; q--; int dx = a.at(p) - a.at(q), dy = b.at(p) - b.at(q); to.at(p).emplace_back(q, sqrt(dx * dx + dy * dy)); to.at(q).emplace_back(p, sqrt(dx * dx + dy * dy)); } vector d(n, 1e9); d.at(x) = 0; priority_queue> que; que.emplace(0, x); while (!que.empty()) { auto t = que.top(); double d0 = -t.first; int v = t.second; que.pop(); if (v == y) break; if (d.at(v) < d0) continue; for (auto next : to.at(v)) { if (d.at(next.first) <= d0 + next.second) continue; d.at(next.first) = d0 + next.second; que.emplace(-d.at(next.first), next.first); } } cout << setprecision(17) << d.at(y) << endl; }