#include using namespace std; int main(void){ // Your code here! int N, M; cin >> N >> M; int X, Y; cin >> X >> Y; X--; Y--; map> D; map distD; vector> p(N); int x, y; for (int i=0;i> x >> y; p[i] = make_pair(x, y); } for (int i=0;i> x >> y; x--; y--; if (D.count(x)){ D[x].push_back(y); } else{ D[x] = {y}; } if (D.count(y)){ D[y].push_back(x); } else{ D[y] = {x}; } distD[x*N+y] = sqrt((p[x].first-p[y].first)*(p[x].first-p[y].first)+(p[x].second-p[y].second)*(p[x].second-p[y].second)); distD[y*N+x] = sqrt((p[x].first-p[y].first)*(p[x].first-p[y].first)+(p[x].second-p[y].second)*(p[x].second-p[y].second)); } priority_queue, vector>, greater>> pq; vector dist(N, 1e9); dist[X] = 0.0; for (int i=0;i tmp; int r; while (!pq.empty()){ tmp = pq.top(); pq.pop(); r = tmp.second; if (D.count(r)){ for (int i: D[r]){ if (dist[i] > dist[r] + distD[(long long)r*N+i]){ dist[i] = dist[r] + distD[(long long)r*N+i]; pq.push(make_pair(dist[i], i)); } } } } printf("%.015f\n", dist[Y]); return 0; }