#include  <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

const int vmax=10010;
const int inf=1023456789;

int N,M;
typedef tuple<double,int,int> node;
vector<node> graph;

int par[vmax];
void init(){rep(i,vmax) par[i]=i;}
int find(int x){return (par[x]==x)?x:par[x]=find(par[x]);}
void unite(int a,int b){a=find(a),b=find(b);par[a]=b;}
bool same(int a,int b){return find(a)==find(b);}

double kruskal(){
	init();
	sort(begin(graph),end(graph));
	reverse(begin(graph),end(graph));
	double res=0;
	for(auto &e:graph){
		int a,b;
		double c;
		tie(c,a,b)=e;
		if(!same(a,b)) unite(a,b),res+=c;
	}
	return res;
}

complex<double> p[vmax];

int main(void){
	cin >> N >> M;
	rep(i,N){
		double x,y;
		cin >> x >> y;
		p[i]={x,y};
	}
	double sum=0.0;
	rep(i,M){
		int a,b;
		cin >> a >> b;
		a--,b--;
		double c=abs(p[a]-p[b]);
		sum+=c;
		graph.push_back(node(c,a,b));
	}
	cout.precision(10);
	cout << fixed << sum-kruskal() << endl;
	return 0;
}