//?????§??????????£???????????????¶?????????????????¨?????§??¨????£???§???????????¨????????????.
//?????????????????°??????????????¢??°????????????????????????????????????#N - #E + #F = 2, #F <= #N - 1 (????§???¢??????????????´???????????§)
//??????, #E = #2N - 3????????????. ?????£???, M ??? 2 * N - 3??¨??????, ???????????????????????¨???????????£??????
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cmath>
using namespace std;

struct Edge {
	int src, dst;
	double cost;
	Edge() {
	}
	Edge(int s, int d, double c) {
		src = s; dst = d; cost = c;
	}
	bool operator>(const Edge &r) const {
		return cost > r.cost;
	}
};

class UF {
	int par[10000];
public:
	UF() { for (int i = 0; i < 10000; i++) par[i] = i; }
	int root(int x) { if (par[x] == x) return x; return par[x] = root(par[x]); }
	void marge(int x, int y) { x = root(x); y = root(y); par[x] = y; }
	bool isSame(int x, int y) { return root(x) == root(y); }
};

int n, m;
int x[10000], y[10000];
vector<Edge> edges;
UF uf;

int main() {
	int i;
	
	cin >> n >> m;
	for (i = 0; i < n; i++) cin >> x[i] >> y[i];
	
	double sumCost = 0;
	for (i = 0; i < m; i++) {
		int p, q;
		double c;
		cin >> p >> q; p--; q--;
		c = (x[p] - x[q]) * (x[p] - x[q]) + (y[p] - y[q]) * (y[p] - y[q]);
		c = sqrt(c);
		edges.push_back(Edge(p, q, c));
		sumCost += c;
	}
	sort(edges.begin(), edges.end(), greater<Edge>());
	
	double treeCost = 0;
	for (i = 0; i < edges.size(); i++) {
		int s = edges[i].src;
		int d = edges[i].dst;
		if (!uf.isSame(s, d)) {
			uf.marge(s, d);
			treeCost += edges[i].cost;
		}
	}
	
	printf("%.14f\n", sumCost - treeCost);
	return 0;
}