#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#define maxn 11000
#define oo 0xfffffff
using namespace std;
int father[maxn], n, m;
struct node
{
    int u, v;
    double w;
} s[maxn*100];///数?大小
struct point
{
    int x, y;
} a[maxn];
double Len(int p, int q)
{
    double d = sqrt((a[p].x-a[q].x)*(a[p].x-a[q].x)+(a[p].y-a[q].y)*(a[p].y-a[q].y));
    return d;
}
int Find(int x)
{
   while(x!=father[x])
     x=father[x];
     return x;
}
int cmp(node p, node q)
{
    return p.w>q.w;
}
double solve()
{
    double ans = 0;
    for(int i=0; i<m; i++)
    {
        int ru = Find(s[i].u);
        int rv = Find(s[i].v);
        if(ru != rv)
        {
            father[ru] = rv;
            ans += s[i].w;
        }
    }
    return ans;
}
int main()
{
    int u, v;
    while(scanf("%d %d",&n, &m)!=EOF)
    {
        double sum = 0;
        for(int i=1; i<=n; i++)
            scanf("%d %d", &a[i].x, &a[i].y);
        for(int i=1; i<=n; i++)
            father[i] = i;
        for(int i=0; i<m; i++)
        {
            scanf("%d %d", &u, &v);
            s[i].u = u;
            s[i].v = v;
            s[i].w = Len(u, v);
            sum += s[i].w;
        }
        sort(s, s+m, cmp);
        double l = solve();
        printf("%.3f\n", sum-l);
    }
    return 0;
}