// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <iostream>

#include <algorithm>

#include <queue>

#include <map>

#include <stack>

#include <string>

#include <cmath>

#include <cstdlib>

#include <set>

using namespace std;



#define M 1e9+7

typedef long long ll;

#define  mem(a) memset(a,0,sizeof a)

#define pi acos(-1.0)

#define inf 0x3f3f3f

struct node

{

        int u,v;double w;

}mp[100000];

struct node1

{

        double x,y;

}c[10005];

int n,m;

int f[10005];

bool cmp(node a,node b)

{

        return a.w > b.w;

}

int find(int x)

{

        while(x != f[x])

                x = f[x];

        return x;

}

int main()

{

        while(~scanf("%d %d",&n,&m))

        {

                for(int i = 1 ; i <= n ; i ++)

                        scanf("%lf %lf",&c[i].x,&c[i].y);

                for(int i = 0 ; i < m ; i ++)

                {

                        int a,b;

                        scanf("%d %d",&a,&b);

                        mp[i].u = a;

                        mp[i].v = b;

                        mp[i].w = sqrt ((c[a].x-c[b].x )*(c[a].x-c[b].x) + (c[a].y-c[b].y)*(c[a].y - c[b].y));

                }

                sort(mp,mp+m,cmp);

                double ans = 0;

                for(int i = 1 ; i <= n ; i ++)

                        f[i] = i;

                for(int i = 0 ; i < m ; i ++)

                {

                        int a = mp[i].u;

                        int b = mp[i].v;

                        int fa = find(a);

                        int fb = find(b);

                        if(fa == fb)

                                ans += mp[i].w;

                        else

                        {

                                int mi = min(fa,fb);

                                int ma = max(fa,fb);

                                f[ma] = mi;

                        }

                }

                printf("%.3f\n",ans);

        }





        return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.661462408570357x):
#include <cstdio>

#include <cstring>

#include <cmath>

#include <algorithm>

using namespace std;



struct node

{

    int x,y,id;

};

struct edge

{

    int u,v;

    double cost;

    edge() {}

    edge(int x,int y,double z)

    {

        u=x;

        v=y;

        cost=z;

    }

    bool operator <(const edge& a) const

    {

        return cost>a.cost;

    }

};



edge es[50010];

int par[10010];

node p[10010];

int n,m;

void init()

{

    for(int i=1;i<=n;i++) par[i]=i;

}



int find(int x)

{

    return x==par[x]?x:par[x]=find(par[x]);

}



void unite(int x,int y)

{

    x=find(x);

    y=find(y);

    if(x!=y) par[x]=y;

}



double dis(int a,int b)

{

    return sqrt(1.0*(p[a].x-p[b].x)*(p[a].x-p[b].x)+1.0*(p[a].y-p[b].y)*(p[a].y-p[b].y));

}



double kruskal()

{

    sort(es,es+m);

    //for(int i=0;i<m;i++) printf("%d %d %lf\n",es[i].u,es[i].v,es[i].cost);

    double s=0;

    for(int i=0;i<m;i++)

    {

        edge e=es[i];

        if(find(e.u)!=find(e.v))

        {

            unite(e.u,e.v);

        }

        else

        {

            s+=e.cost;

        }

    }

    return s;

}

int main()

{

    //freopen("a.txt","r",stdin);

    int a,b;

    double c,sum;

    while(~scanf("%d%d",&n,&m))

    {

        init();

        sum=0;

        for(int i=1;i<=n;i++)

        {

            scanf("%d%d",&p[i].x,&p[i].y);

        }

        for(int i=0;i<m;i++)

        {

            scanf("%d%d",&a,&b);

            c=dis(a,b);

            es[i]=edge(a,b,c);

        }

        printf("%.3lf\n",kruskal());

    }

    return 0;

}