#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using pii = pair; using ll=long long; using ld=long double; #define pb push_back #define mp make_pair #define sc second #define fr first #define stpr setprecision #define cYES cout<<"YES"<=0;i--) #define rRep(i,a,b) for(ll i=a;i>=b;i--) #define crep(i) for(char i='a';i<='z';++i) #define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; } template inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; } template istream& operator>>(istream& is,vector& v){for(auto&& x:v)is >> x;return is;} template istream& operator>>(istream& is, pair& p){ is >> p.first; is >> p.second; return is;} template ostream& operator>>(ostream& os, const pair& p){ os << p.first << ' ' << p.second; return os;} template ostream& operator<<(ostream& os, vector& v){ for(auto i=begin(v); i != end(v); ++i){ if(i !=begin(v)) os << ' '; os << *i; } return os; } ld A[200007],B[200007]; struct Edge { ll to;ld cost; Edge(ll to, ld cost) : to(to), cost(cost) {} }; typedef vector > AdjList; // 辺の情報 typedef vector dis_dijkstra; // 距離のvector dis_dijkstra dijkstra(ll n ,AdjList A,ll st ,ld weigh){// 頂点数 n ,グラフ A ,始点 st ,初期値 weigh dis_dijkstra DIS; vector chek; DIS = vector(n+1, LINF); chek = vector(n+1, 0); DIS[st]=weigh; ll key=st; priority_queue > PQ; PQ.push(mp(weigh,st)); while(PQ.empty()!=1){ pair f = PQ.top(); PQ.pop(); key=f.second; chek[key]=1; if(DIS[key] < f.first*(-1)){ continue; } rep(j,A[key].size()){ ld v = A[key][j].to; if(chek[v]==0 && DIS[v]>DIS[key]+A[key][j].cost){ DIS[v] = DIS[key] + A[key][j].cost; PQ.push(mp(DIS[v]*(-1),v)); //ここ } } } return DIS; } int main(){ ll N,M,X,Y,x,y; cin>> N >> M >> X >> Y; rep(i,N){ cin >> A[i+1] >> B[i+1]; } AdjList graph; graph = AdjList(N+1); rep(i,M){ cin >> x >> y; ld L=sqrt((A[x]-A[y])*(A[x]-A[y])+(B[x]-B[y])*(B[x]-B[y])); graph[x].push_back(Edge(y, L)); graph[y].push_back(Edge(x, L)); } dis_dijkstra dis = dijkstra(N,graph,X,0LL); cout << stpr(10) << dis[Y] << endl; }