// Enjoy your stay.

#include <bits/stdc++.h>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define mt make_tuple
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)(x).size())

using namespace std;

typedef istringstream iss;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef stringstream sst;
typedef vector<ll> vi;

//
int par_uf[100010],rank_uf[100010];

void init(int n){for(int i=0;i<n;i++){par_uf[i]=i;rank_uf[i]=0;}}
int find(int x){if(par_uf[x]==x)return x;else return par_uf[x]=find(par_uf[x]);}
void unite(int x,int y){x=find(x);y=find(y);if(x==y)return;if(rank_uf[x]<rank_uf[y])par_uf[x]=y;else{par_uf[y]=x;if(rank_uf[x]==rank_uf[y])rank_uf[x]++;}}
bool same(int x,int y){return find(x)==find(y);}
//

int N,M,x[10010],y[10010];
pair<double,pi> e[100010];

#define sq(x) ((x)*(x))

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	cin>>N>>M;
	rep(i,N)cin>>x[i]>>y[i];
	double ans=0;
	rep(i,M){
		int p,q;
		cin>>p>>q;
		p--;q--;
		double len=sqrt(sq(x[p]-x[q])+sq(y[p]-y[q]));
		ans+=len;
		e[i]=mp(-len,mp(p,q));
	}
	sort(e,e+M);
	init(N);
	rep(i,M){
		int p=e[i].sec.fir,q=e[i].sec.sec;
		if(!same(p,q)){
			ans+=e[i].fir;
			unite(p,q);
		}
	}
	cout<<fixed<<setprecision(16)<<ans<<endl;
}