#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; // g <- pair < v , cost > template < class T > vector< T > dijkstra(vector>> &graph, int s) { T INF = numeric_limits< T >::max(); vector dist(graph.size(), INF); priority_queue, vector>, greater>> q; q.push({dist[s] = T(0), s}); while(!q.empty()){ auto [uc, ui] = q.top(); q.pop(); if(uc != dist[ui]) continue; for(auto [vi, vc] : graph[ui]) if(dist[vi] > uc + vc) q.push({dist[vi] = uc + vc, vi}); } return dist; } int main(){ cin.tie(0); ios::sync_with_stdio(0); int N,M,X,Y; cin >> N >> M >> X >> Y; X--; Y--; using ld = long double; vector> pq(N); for(auto &[p, q] : pq) cin >> p >> q; vector>> G(N); rep(i,M) { int p,q; cin >> p >> q; p--; q--; auto [px, py] = pq[p]; auto [qx, qy] = pq[q]; ld dist = (px - qx) * (px - qx) + (py - qy) * (py - qy); dist = sqrtl(dist); G[p].push_back({q, dist}); G[q].push_back({p, dist}); } cout << fixed << setprecision(20) << dijkstra(G, X)[Y] << endl; }