1 #include<cstdio>
2 #include<iostream>
3 #include<cmath>
4 #include<algorithm>
5 #define maxn 2000
6 using namespace std;
7
8 int n,m,x[maxn],y[maxn];
9
10 int pre[maxn];
11 int find(int x){
12 if(!pre[x]) return x;
13 else{
14 pre[x] = find(pre[x]);
15 return pre[x];
16 }
17 }void unite(int a,int b){
18 if(find(a) != find(b)) pre[find(a)] = find(b);
19 }
20
21 struct edge{
22 int u,v;
23 double len;
24 }e[maxn*maxn];
25
26 int tot;
27 void insert(int u,int v,double len){
28 tot++;
29 e[tot].u = u;
30 e[tot].v = v;
31 e[tot].len = len;
32 }
33
34 double getdis(int a,int b){
35 return sqrt(1LL*(x[a]-x[b])*(x[a]-x[b])+1LL*(y[a]-y[b])*(y[a]-y[b]));
36 }
37
38 bool cmp(const edge &a,const edge &b){
39 return a.len < b.len;
40 }
41
42 void kruskal(){
43 sort(e+1,e+1+tot,cmp);
44
45 double ans = 0;
46
47 for(int i = 1;i <= tot;i++){
48 int u = e[i].u,v = e[i].v;
49 if(find(u) != find(v)){
50 unite(u,v);
51 ans += e[i].len;
52 }
53 }
54
55 printf("%.2lf",ans);
56 }
57
58 int main(){
59 scanf("%d%d",&n,&m);
60
61 for(int i = 1;i <= n;i++){
62 scanf("%d%d",&x[i],&y[i]);
63 }
64
65 for(int i = 1;i <= m;i++){
66 int a,b;
67 scanf("%d%d",&a,&b);
68 unite(a,b);
69 }
70
71 for(int i = 1;i <= n;i++){
72 for(int j = i+1;j <= n;j++){
73 if(find(i) != find(j)){
74 insert(i,j,getdis(i,j));
75 }
76 }
77 }
78
79 kruskal();
80
81 return 0;
82 }