#include<iostream>#include<queue>#include<math.h>using namespace std;int father[101];int fine(int x){int r=x,j;while(father[r]>0)r=father[r];while(r!=x){ j=father[x]; father[x]=r; x=j;}return r;}void weightmerge(int x,int y){int temp;int ix,iy;ix=fine(x);iy=fine(y);temp=father[ix]+father[iy];if(ix!=iy)if(father[ix]>father[iy]){father[iy]=temp;father[ix]=iy;}else{father[ix]=temp;father[iy]=ix;}}struct edge{double st,end;double weight;friend bool operator < (edge a,edge b){return a.weight>b.weight;}};priority_queue<edge> que;double Kruskal();int num;int main(){bool flag=false;int icase=1;edge city[101];while(cin>>num){int i,j,ci=1;if(!num)break;for(i=1;i<=num;i++){cin>>city[ci].st>>city[ci].end;ci++;}for(i=1;i<=num;i++)father[i]=-1;edge aedge;while(!que.empty())que.pop();for(i=1;i<=num;i++)for(j=i+1;j<=num;j++){aedge.st=i;aedge.end=j;aedge.weight=(city[i].st-city[j].st)*(city[i].st-city[j].st)+(city[i].end-city[j].end)*(city[i].end-city[j].end);que.push(aedge);}cout.setf(ios::fixed);cout.precision(2);if(flag)cout<<endl;flag=true;cout<<"Case #"<<icase++<<":"<<endl<<"The minimal distance is: "<<Kruskal()<<endl;}}double Kruskal(){int Account=0;double sum=0;edge temp;while(!que.empty()&&Account!=num){temp=que.top();que.pop();if(fine(temp.st)!=fine(temp.end)){weightmerge(temp.st,temp.end);if((-father[fine(temp.st)])>Account)Account=0-father[fine(temp.st)];sum+=sqrt(temp.weight);}}return sum;}


