#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

typedef pair<int,double> P;

const int MAX_N=1e4;

int N,M;
int x[MAX_N],y[MAX_N];

vector<P> G[MAX_N];

double mincost[MAX_N];
bool used[MAX_N];

double prim(){
	fill(mincost,mincost+N,-1);
	mincost[0]=0;
	double ans=0;
	while(1){
		int v=-1;
		REP(i,N){
			if (!used[i] && (v==-1 || mincost[v]<mincost[i])){
				v=i;
			}
		}
		if (v==-1) break;
		used[v]=true;
		if (mincost[v]!=-1){
			ans+=mincost[v];
		}
		REP(i,G[v].size()){
			P p=G[v][i];
			mincost[p.first]=max(mincost[p.first],p.second);
		}
	}
	return ans;
}

int main(){
	double sum=0;
	scanf("%d %d",&N,&M);
	REP(i,N){
		scanf("%d %d",&x[i],&y[i]);
	}
	REP(i,M){
		int p,q;
		scanf("%d %d",&p,&q);
		p--;
		q--;
		double cost=sqrt((double)(x[p]-x[q])*(x[p]-x[q])+(y[p]-y[q])*(y[p]-y[q]));
		G[p].push_back(P(q,cost));
		G[q].push_back(P(p,cost));
		sum+=cost;
	}
	printf("%.5f\n",sum-prim());
	return 0;
}