#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#define pi acos(-1)
#define LL long long
#define INF 0x3f3f3f3f
using namespace std;
typedef pair<int, int> P;
const int maxn = 1e5 + 5;

struct edge
{
    int a, b;
    double len;
}fenc[maxn];
struct Point
{
    int x, y;
}p[maxn];
double cal(int a, int b)
{
    double x = p[a].x*1.0 - p[b].x*1.0;
    double y = p[a].y*1.0 - p[b].y*1.0;
    return sqrt(x*x + y*y);
}
int cmp(edge a, edge b)
{
    if (a.len > b.len) return 1;
    return 0;
}
int ret[maxn];
int find(int a)
{
    if (ret[a] == -1) return a;
    return ret[a] = find(ret[a]);
}
int main(void)
{
//	freopen("C:\\Users\\wave\\Desktop\\NULL.exe\\NULL\\in.txt","r", stdin);
    int n, m, i, j, k, a, b;
    double ans;
    while (cin >> n >> m)
    {
        for (i = 1; i <= n; i++)
            scanf("%d %d", &p[i].x, &p[i].y);
        for (i = 1; i <= m; i++){
            scanf("%d %d", &a, &b);
            fenc[i].a = a;
            fenc[i].b = b;
            fenc[i].len = cal(a, b);
        }
        sort(fenc+1, fenc+1+m, cmp);
        memset(ret, -1, sizeof(ret));
        ans = 0;
        for (i = 1; i <= m; i++){
            int x = find(fenc[i].a);
            int y = find(fenc[i].b);
            if (x == y)
                ans += fenc[i].len;
            else ret[x] = y;
        }
        printf("%.3f\n", ans);
    }

    return 0;
}