#include<iostream>
#include<vector>
#include<cmath>
#include<cstdio>
using namespace std;
vector<pair<int, double>>X[12000];
int N, M, a, b; double x[12000], y[12000], d[12000]; int g[12000];
int main() {
	cin >> N >> M; double S = 0;
	for (int i = 1; i <= N; i++)cin >> x[i] >> y[i];
	for (int i = 1; i <= M; i++) {
		cin >> a >> b;
		double c = pow((x[a] - x[b]), 2) + pow(y[a] - y[b], 2);
		c = sqrt(c); X[a].push_back(make_pair(b, c)); S += c;
		X[b].push_back(make_pair(a, c));
	}
	for (int t = 1; t <= N; t++) {
		if (g[t] >= 2)continue;
		d[t] = 0; g[t] = 1;
		while (true) {
			int OK = 1;
			for (int i = 1; i <= N; i++) {
				if (g[i] == 1)OK = 0;
			}
			if (OK == 1)break;
			double maxn = -1; int maxid = 0;
			for (int i = 1; i <= N; i++) {
				if (g[i] == 1 && maxn < d[i]) {
					maxn = d[i]; maxid = i;
				}
			}
			g[maxid] = 2;
			for (int i = 0; i < X[maxid].size(); i++) {
				int to = X[maxid][i].first; double dist = X[maxid][i].second;
				if (g[to] <= 1 && d[to] < dist) {
					d[to] = dist; g[to] = 1;
				}
			}
		}
	}
	double sum = 0;
	for (int i = 2; i <= N; i++) {
		sum += d[i];
	}
	printf("%.50f", S - sum);
	return 0;
}