#include using namespace std; typedef long long ll; typedef pair P; #define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0) #define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0) templateostream& operator<<(ostream& os,const pair& a) {os << "(" << a.first << ", " << a.second << ")";return os;} const char newl = '\n'; template void dijkstra(int s,vector>>& edges,vector& dist) { priority_queue,vector>,greater>> que; dist[s] = 0; que.push(make_pair(0,s)); while (!que.empty()) { pair p = que.top(); que.pop(); int v = p.second; if (dist[v] < p.first) continue; for (pair& e : edges[v]) { if (dist[e.first] > dist[v]+e.second) { dist[e.first] = dist[v]+e.second; que.push(make_pair(dist[e.first],e.first)); } } } } int main() { int n,m,x,y; cin >> n >> m >> x >> y; x--;y--; vector p(n),q(n); vector>> edges(n); for (int i = 0;i < n;++i) cin >> p[i] >> q[i]; for (int i = 0;i < m;++i) { int u,v; scanf("%d%d",&u,&v); u--;v--; double d = sqrt((p[u]-p[v])*(p[u]-p[v])+(q[u]-q[v])*(q[u]-q[v])); edges[u].push_back({v,d}); edges[v].push_back({u,d}); } vector dist(n,1e9); dijkstra(x,edges,dist); cout << fixed << setprecision(12) << dist[y] << endl; }