#include using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair P; constexpr int INF = 2e9; typedef long double ld; int main() { int n, m; cin >> n >> m; int x, y; cin >> x >> y; x--; y--; vector> p; rep(i,n) { ld a, b; cin >> a >> b; p.emplace_back(make_pair(a, b)); } vector>> g(n); rep(i,m) { int u, v; cin >> u >> v; u--; v--; ld s = (p[u].first - p[v].first), t = (p[u].second - p[v].second); ld d = sqrt((s * s) + (t * t)); g[u].emplace_back(make_pair(v, d)); g[v].emplace_back(make_pair(u, d)); } vector dist(n, INF); priority_queue, vector>, greater>> pq; pq.push(make_pair(0.0, x)); dist[x] = 0.0; while (!pq.empty()) { auto t = pq.top(); pq.pop(); int u = t.second; if (t.first > dist[u]) continue; for (auto e : g[u]) { ld cost = e.second; int v = e.first; if (dist[v] > dist[u] + cost) { dist[v] = dist[u] + cost; pq.push(make_pair(dist[v], v)); } } } printf("%.12Lf\n", dist[y]); return 0; }