#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxm 100005
#define maxn 10005
using namespace std;
typedef long long ll;
struct edge{
	int from,to;
	double cst;
	bool operator <(const edge e)const
	{
		return cst > e.cst;
	}
}el[maxm];
int par[maxn],hei[maxn],E,n,m,x[maxn],y[maxn];
double tot,ans;
inline void ini(int x){
	for(int i=1;i<=x;i++){
		par[i] = i;
		hei[i] = 1;
	}
}
int fin(int x){
	if(par[x] == x) return x;
	return par[x] = fin(par[x]);
}
inline void uni(int x,int y){
	x = fin(x);y = fin(y);
	if(x==y) return;
	if(hei[x] < hei[y]) par[x] = y;
	else{
		par[y] = x;
		if(hei[x] == hei[y]) hei[x]++;
	}
}
inline bool same(int x,int y){
	return fin(x) == fin(y);
}
inline void kruskal(){
	ini(n);
	sort(el+1,el+E+1);
	for(int i=1;i<=E;i++){
		if(!same(el[i].from,el[i].to)){
			uni(el[i].from,el[i].to);
			ans += el[i].cst;
		}
	}
	printf("%.5lf\n",tot - ans);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&x[i],&y[i]);
	}
	for(int i=1;i<=m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		el[++E].from = u;
		el[E].to = v;
		el[E].cst = sqrt((x[u]-x[v])*(x[u]-x[v])+(y[u]-y[v])*(y[u]-y[v]));
		tot += el[E].cst;
	}
	kruskal();
	return 0;
}

