#pragma  warning (disable:4996)
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int x[10002];
int y[10002];
int fa[10002];
int n, m;
int num;
struct edge{
	int u;
	int v;
	double cost;
};
bool cmp(edge a, edge b){
	return a.cost < b.cost;
}
edge es[1000000];
int find(int a){
	if (a == fa[a]) return a;
	else return fa[a] = find(fa[a]);
}
bool same(int a, int b){
	int aa = find(a);
	int bb = find(b);
	if (aa==bb) return true;
	else return false;
}

void unite(int a, int b){
	int aa = fa[a];
	int bb = fa[b];
	if (aa != bb){
		fa[aa] = bb;
	}
}
double krusal(){
	sort(es, es + num, cmp);
	double res = 0;
	for (int i = 1; i <= n; i++) fa[i] = i;
	for (int i = 0; i < num; i++){
		edge e = es[i];
		if (!same(e.u, e.v)){
			unite(e.u, e.v);
			res += e.cost;
		}
	}
	return res;
}
int main(){
	
	cin >> n >> m;
	for (int i = 1; i <= n; i++)cin >> x[i] >> y[i];
	num = 0;
	int u, v;
	double d;
	double  sum = 0;
	while (m--){
		cin >> u >> v;
		d = (x[u] - x[v])*(x[u] - x[v]) + (y[u] - y[v])*(y[u] - y[v]);
			d = sqrt(d);
			es[num].u = u;
			es[num].v = v;
			es[num++].cost = -d;
			sum += d;
	}
	double ans = sum + krusal();
	printf("%.3lf\n", ans);
	return 0;
}