#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define N 10100
#define inf
#define mod
#define rg register
using namespace std;
typedef long long ll;
typedef double db;
int n,m,fa[N],x[N],y[N];
db tot=0,ans=0;
struct data{
	int x,y;
	db z;
}q[N*10];
bool cmp(data a,data b){ return a.z>b.z; }
int find(int k){ return fa[k]==k?fa[k]:fa[k]=find(fa[k]); }
db get_dis(int a,int b){ return sqrt((x[a]-x[b])*(x[a]-x[b])+(y[a]-y[b])*(y[a]-y[b])); }
int main(){
//	freopen ("2224.in","r",stdin);
//	freopen ("2224.out","w",stdout);
	scanf ("%d%d",&n,&m);
	for (int i=1;i<=n;++i) scanf ("%d%d",&x[i],&y[i]),fa[i]=i;
	for (int i=1;i<=m;++i){
		scanf ("%d%d",&q[i].x,&q[i].y);
		q[i].z=get_dis(q[i].x,q[i].y);tot+=q[i].z;
	}
	sort(q+1,q+m+1,cmp);
	int cnt=0;
	for (int i=1;i<=m;++i){
		int f1=find(q[i].x),f2=find(q[i].y);
		if (f1==f2) continue;
		fa[f1]=f2;
		cnt++;ans+=q[i].z;
		if (cnt==n-1) break;
	}
	printf ("%.3lf\n",tot-ans);
	return 0;
}