// Original C++ solution (slower):
#include <iostream>  

#include <cstdio>  

#include <cstring>  

#include <algorithm>  

#include <cmath>  

#include <string>  

#include <map>  

#include <stack>  

#include <vector>  

#include <set>  

#include <queue>  

#pragma comment (linker,"/STACK:102400000,102400000")  

#define maxn 10000+10  

#define MAXN 2005  

#define mod 1000000009  

#define INF 0x3f3f3f3f  

#define pi acos(-1.0)  

#define eps 1e-6  

#define lson rt<<1,l,mid  

#define rson rt<<1|1,mid+1,r  

typedef long long ll;  

using namespace std;  

  

struct Edge  

{  

    int u,v;  

    double dis;  

}edge[maxn*maxn/2];  

  

int N,M;  

int father[maxn];  

double x[maxn],y[maxn];  

  

int cmp(Edge x,Edge y)  

{  

    return x.dis>y.dis;  

}  

  

void init(int n)  

{  

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

        father[i]=i;  

}  

  

int find_father(int x)  

{  

    if (x!=father[x])  

        father[x]=find_father(father[x]);  

    return father[x];  

}  

  

double Kruskal()  

{  

    double s=0;  

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

    {  

        int fu=find_father(edge[i].u);  

        int fv=find_father(edge[i].v);  

        if (fu!=fv)  

        {  

            father[fu]=fv;  

            s+=edge[i].dis;     //不需要破?的?的?度之和  

        }  

    }  

    return s;  

}  

  

int main()  

{  

    while (~scanf("%d%d",&N,&M))  

    {  

        init(N);  

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

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

        int u,v;  

        double sum=0.0;  

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

        {  

            scanf("%d%d",&u,&v);  

            edge[i].u=u;  

            edge[i].v=v;  

            edge[i].dis=sqrt( (x[u]-x[v])*(x[u]-x[v])+(y[u]-y[v])*(y[u]-y[v]) );  

            sum+=edge[i].dis;       //sum存下所有?的?度之和  

        }  

        sort(edge,edge+M,cmp);  

        printf("%.3f\n",sum-Kruskal());  

    }  

    return 0;  

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
#include<bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

typedef vector<int> vi;

typedef double D;



class edge{

public:

  int s,t;

  int cost;

  edge(int a,int b,int c):s(a),t(b),cost(c){}

  bool operator<(const edge &e)const{return cost<e.cost;}

};



class UF{

  vi p,r;



public:

  UF(int n):p(n,-1),r(n,0){ }



  int find(int x){ return (p[x]<0)?x:(p[x] = find(p[x])); }



  void unite(int x,int y){

    x = find(x); y = find(y);

    if(x==y)return;



    if(r[x] < r[y])p[x] = y;

    else p[y] = x;

    if(r[x] == r[y])r[x]++;

  }



  bool same(int x,int y){return find(x)==find(y);}

};



inline int dis2(int x1, int y1, int x2, int y2){

  return (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);

}



int main(){

  cin.tie(0); ios::sync_with_stdio(0);

  int n,m;

  cin >> n >> m;

  

  vector<D> x(n),y(n);

  for(int i=0;i<n;i++)cin >> x[i] >> y[i];



  vector<edge> e;

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

    int a,b;

    cin >> a >> b; a--; b--;

    e.push_back(edge(a,b,dis2(x[a],y[a],x[b],y[b])));

  }



  sort(e.begin(), e.end());

  reverse(e.begin(), e.end());

  

  UF uf(n);

  D ans = 0;

  rep(i,m){

    if(uf.same(e[i].s,e[i].t))ans += sqrt(e[i].cost);

    else uf.unite(e[i].s,e[i].t);

  }

  cout << fixed << setprecision(9) << ans << endl;

}