#include<cstdio>  
#include<cmath>  
#include<algorithm>  
using namespace std;  
const int maxn=10005;  
int pre[maxn];  
struct node  
{  
    int a,b;  
    double len;  
}point[maxn],edge[maxn*100];  
double dist(node x,node y)  
{  
    return sqrt((x.a*1.0-y.a)*(x.a-y.a)+(x.b*1.0-y.b)*(x.b-y.b));  
}  
void init(int n)  
{  
    for(int i=1;i<=n;++i)  
    {  
        pre[i]=i;  
    }  
}  
int find(int x)  
{  
    int r=x;  
    while(r!=pre[r])  
    {  
        r=pre[r];  
    }  
    int i=x,j;  
    while(i!=r)  
    {  
        j=pre[i];  
        pre[i]=r;  
        i=j;  
    }  
    return r;  
}  
int join(int x,int y)  
{  
    int fx=find(x),fy=find(y);  
    if(fx!=fy)  
    {  
        pre[fx]=fy;  
        return 1;  
    }  
    return 0;  
}  
int cmp(node a,node b)  
{  
    return a.len>b.len;  
}  
double kruscal(int n,int m)  
{  
    sort(edge,edge+m,cmp);  
    int cnt=0;double ans=0;  
    for(int i=0;i<m&&cnt<n-1;++i)  
    {  
            if(join(edge[i].a,edge[i].b))  
            {  
                ans+=edge[i].len;  
                ++cnt;  
            }  
    }  
    return ans;  
}  
int main()  
{  
    int n,m;  
//  freopen("shuju.txt","r",stdin);  
    while(~scanf("%d%d",&n,&m))  
    {  
        init(n);  
        for(int i=1;i<=n;++i)  
        {  
            scanf("%d%d",&point[i].a,&point[i].b);  
        }  
        double sum=0;  
        for(int i=0;i<m;++i)  
        {  
            int a,b;  
            scanf("%d%d",&a,&b);  
            node tp={a,b,dist(point[a],point[b])};  
            edge[i]=tp;  
            sum+=tp.len;  
        }  
        printf("%.4f\n",sum-kruscal(n,m));  
    }  
    return 0;  
}  