#include using namespace std; double calc_dist(int x1, int y1, int x2, int y2){ long long tmpx = (x1 - x2) * (x1 - x2); long long tmpy = (y1 - y2) * (y1 - y2); return sqrt(tmpx + tmpy); } int main(void){ // Your code here! int N, M; cin >> N >> M; int X, Y; cin >> X >> Y; X--; Y--; map> D; 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}; } } 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] + calc_dist(p[i].first, p[i].second, p[r].first, p[r].second)){ dist[i] = dist[r] + calc_dist(p[i].first, p[i].second, p[r].first, p[r].second); pq.push(make_pair(dist[i], i)); } } } } printf("%.015f\n", dist[Y]); return 0; }