#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<numeric>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<functional>
#include<bitset>
#include<math.h>
#include<cstring>
#include<iomanip>
#pragma warning(disable:4996)
#define ll long long
#define INF 0X3f3f3f3f
#define mod 80112002
using namespace std;
const int maxn = 1010;
const int maxm = 1e6;
int n = 0, m = 0;
int tot = 0;
struct Node {
int x, y;
long double distance(const Node& a) {
return sqrt((a.x - x)*(a.x - x) + (a.y - y)*(a.y - y));
}
}node[maxn];
struct Edge {
int u, v;
long double w;
bool operator<(const Edge&x)const {
return w < x.w;
}
}edge[maxm];
long double dist[maxn][maxn];
int fa[maxn];
int find(int x) {
while (x != fa[x])
x = fa[x] = fa[fa[x]];
return x;
}
void kruskal() {
sort(edge + 1, edge + tot + 1);
int eu = 0, ev = 0, cnt = 0;
long double ans = 0.0;
for (int i = 1; i <= tot; ++i) {
eu = find(edge[i].u), ev = find(edge[i].v);
if (eu == ev)
{
continue;
}
ans += edge[i].w;
fa[ev] = eu;
if (++cnt == n - 1)
{
break;
}
}
cout << fixed << setprecision(2) << ans;
}
int main(){
cin >> n >> m;
for (int i = 1; i <= n; ++i) {
cin >> node[i].x >> node[i].y;
}
for (int i = 1; i <= n; ++i) {
for (int j = i + 1; j <= n; ++j) {
dist[i][j] = node[i].distance(node[j]);
}
dist[i][i] = 0;
}
for (int i = 1; i <= m; ++i) {
int a, b;
cin >> a >> b;
dist[a][b] = dist[b][a] = 0;
}
for (int i = 1; i <= n; ++i) fa[i] = i;
for (int i = 1; i <= n; ++i) {
for (int j = i + 1; j <= n; ++j) {
edge[++tot] = { i,j,dist[i][j] };
}
}
kruskal();
return 0;
}