#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<iostream>
using namespace std;
#define N 11000
int f[N];
int father(int x)
{
    while(x!=f[x])
    {
        x=f[x];
    }
    return x;
}
struct node
{
    double x,y;
}p[N];
struct node1
{
    int b,a;
    double d;
}bian[N*N/2+10];
double dis(node A,node B)
{
    return sqrt((A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y));
}
int cmp(node1 A,node1 B)
{
    return A.d>B.d;
}
int main()
{
    int n,m;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
    for(int i=1;i<=n;i++)
    {
        scanf("%lf%lf",&p[i].x,&p[i].y);
        f[i]=i;
    }
    int num1,num2;
    double sum=0.0;
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d",&num1,&num2);
        bian[i].a=num1;
        bian[i].b=num2;
        bian[i].d=dis(p[num1],p[num2]);
        sum+=bian[i].d;
    }
    double sum1=0.0;
    sort(bian+1,bian+m+1,cmp);
    for(int i=1;i<=m;i++)
    {
        int x1=father(bian[i].a);
        int y1=father(bian[i].b);
        if(f[x1]!=f[y1])
        {
            if(x1>y1)
                f[x1]=y1;
            else
                f[y1]=x1;
            sum1+=bian[i].d;
        }
        else
            continue;
    }
    printf("%.3f\n",sum-sum1);
    }
    return 0;
}