// AOJ 2224: Save your cats
// 2017.10.7 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define EPS 1e-7
#define MAX 10003

/* UNION-FIND library */
int p[MAX], rank[MAX];
void make_set(int x) { p[x] = x, rank[x] = 0; }
void link(int x, int y) {
	if (rank[x] > rank[y]) p[y] = x;
	else { p[x] = y; if (rank[x] == rank[y]) rank[y] = rank[y] + 1;	}
}
int find_set(int x) { if (x != p[x]) p[x] = find_set(p[x]);	return p[x]; }
void union_set(int x, int y) { link(find_set(x), find_set(y)); }

typedef struct { int a, b; double d; } T;
T tbl[50005];

int x[MAX], y[MAX];

int cmp(T *a, T *b)
{
	if (fabs(b->d - a->d) <= EPS) return 0;
	if (a->d <= b->d) return 1;
	return -1;
}

int main()
{
	int n, m, i, s, t;
	double ans, d, dx, dy;

    scanf("%d%d", &n, &m);
    for (i = 1; i <= n; i++) scanf("%d%d",x+i, y+i), make_set(i);
    for (ans = 0, i = 0; i < m; i++) {
        scanf("%d%d", &s, &t);
		dx = x[s] - x[t], dy = y[s] - y[t];
		d = sqrt(dx*dx + dy*dy);
        tbl[i].a = s, tbl[i].b = t, tbl[i].d = d;
        ans += d;
    }
    qsort(tbl, m, sizeof(T), cmp);

    for (i = 0; i < m; i++) {
        s = find_set(tbl[i].a), t = find_set(tbl[i].b);
        if (p[s] != p[t]) union_set(s, t), ans -= tbl[i].d;
    }
    printf("%lf\n", ans);
    return 0;
}