#include <bits/stdc++.h>

struct UnionFind {
private:
	std::vector<int> value;
public:
	UnionFind(int size): value(size, -1){}
	int find(int x){
		return value[x] < 0 ? x : value[x] = find(value[x]);
	}
	int size(int x){
		return -value[find(x)];
	}
	bool same(int x, int y){
		return find(x) == find(y);
	}
	bool unite(int x, int y){
		if ((x = find(x)) == (y = find(y))) return false;
		if (value[x] > value[y]) std::swap(x, y);
		value[x] += value[y];
		value[y] = x;
		return true;
	}
};

using namespace std;

struct Edge {
	int src, dst;
	double cost;
	Edge(){}
	Edge(int src, int dst, double cost): src(src), dst(dst), cost(cost){}
};

int n, m;
int x[10000], y[10000];
vector<Edge> es;

int main()
{
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++){
		scanf("%d %d", x + i, y + i);
	}
	for (int i = 0; i < m; i++){
		int s, t;
		scanf("%d %d", &s, &t); --s; --t;
		double d = sqrt((x[s] - x[t]) * (x[s] - x[t]) + (y[s] - y[t]) * (y[s] - y[t]));
		es.push_back(Edge(s, t, d));
	}
	
	sort(begin(es), end(es), [](const Edge &a, const Edge &b){return a.cost > b.cost;});
	UnionFind uf(n);
	double res = 0;
	for (auto &e : es){
		if (!uf.unite(e.src, e.dst)) res += e.cost;
	}
	printf("%.20f\n", res);
	return 0;
}