#include #define rep(i,n) for(int i=0;i<(int)(n);i++) using namespace std; using ll = long long ; using P = pair ; using pll = pair; constexpr int INF = 1e9; constexpr long long LINF = 1e17; constexpr int MOD = 1000000007; int n = 200005; int m; vector> graph(n,vector()); vector Dijkstra(int start){ vector seen(n,false); vector shortest(n,LINF); priority_queue,greater> pq; pq.push(pll(0.0,start)); while(!pq.empty()){ double dist = pq.top().first; int node = pq.top().second; pq.pop(); if(seen[node]) continue; shortest[node] = dist; seen[node] = true; for(pll next:graph[node]){ int next_node = next.second; double next_cost = next.first; if(seen[next_node]) continue; pq.push(pll(next_cost + dist,next_node)); } } return shortest; } int main(){ cin >> n >> m; int x,y; cin >> x >> y; --x;--y; vector> pq(n); rep(i,n) cin >> pq[i].first >> pq[i].second; rep(i,m){ int p,q; cin >> p >> q; --p;--q; double dis = sqrt((pq[p].first - pq[q].first)*(pq[p].first - pq[q].first) + (pq[p].second-pq[q].second)*(pq[p].second-pq[q].second)); graph[p].push_back(pll(dis,q)); graph[q].push_back(pll(dis,p)); } vector ans = Dijkstra(x); cout << setprecision(20) << ans[y] << endl; return 0; }