#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
#define MAXN 50100
using namespace std;
int x[MAXN],y[MAXN];
struct edge{
	int from,to;double quan;
}e[MAXN*2];
int n,m;int fa[MAXN];
int find(int x){
	if(fa[x]!=x) fa[x]=find(fa[x]);
	return fa[x];
}
double getdis(int f,int s){
	return sqrt((x[f]-x[s])*(x[f]-x[s])+(y[f]-y[s])*(y[f]-y[s]));
}
bool cmp(edge x,edge y){
	return x.quan>y.quan;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) cin>>x[i]>>y[i];//scanf("%f%f",&x[i],&y[i]);
	double ans=0;
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=1;i<=m;i++){
		int xx,yy;scanf("%d%d",&xx,&yy);
		double dis=getdis(xx,yy);
		e[i].from=xx,e[i].to=yy,e[i].quan=dis;
		ans+=dis;
	}
	sort(e+1,e+m+1,cmp);
	for(int i=1;i<=m;i++){
		int xx=find(e[i].from),yy=find(e[i].to);
		if(fa[xx]!=fa[yy]){
			fa[xx]=yy;
			ans-=e[i].quan;
		}
	}
	printf("%0.3f",ans);
	return 0;
}