#include<cstdio> #include<algorithm> #include<cmath> using namespace std; const int maxn=55; struct point { int x,y; }pnt[maxn]; struct edge { int s,e; double len; bool operator < (edge e) const { return len < e.len; } }e[maxn*maxn]; int father[maxn]; double getlen(point a,point b) { return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ); } int find(int x) { if(father[x]==x) { return x; } return find(father[x]); } int main() { int n; while(~scanf("%d",&n),n) { int i,j,p,q; scanf("%d%d",&p,&q); int ne=0; for(i=1;i<=n;i++) { scanf("%d%d",&pnt[i].x,&pnt[i].y); for(j=1;j<i;j++) { e[ne].s=i; e[ne].e=j; e[ne++].len=getlen(pnt[i],pnt[j]); } } sort(e,e+ne); for(i=1;i<=n;i++) { father[i]=i; } double ans=getlen(pnt[p],pnt[q]); father[p]=q; int u,v; for(i=0;i<ne;i++) { u=find(e[i].s); v=find(e[i].e); if(u!=v) { ans += e[i].len; father[u] = v; } } printf("%.2lf\n",ans); } return 0; }