// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<math.h>

#include<algorithm>

using namespace std;

#define N 10000+10

int per[N];

struct Point

{

	double x,y;

}p[N];

struct Edge

{

	int s,e;

	double w;

}a[N*N];

double ma(Point a,Point b)

{

	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));

}

bool cmp(Edge a,Edge b)

{

	return a.w>b.w;

}

int Find(int x)

{

	while(x!=per[x])

		x=per[x];

	return x;

}

int Judge(int x,int y)

{

	int fx=Find(x);

	int fy=Find(y);

	if(fx!=fy)

	{

		per[fx]=fy;

		return 1;

	}

	return 0;

}

int main()

{

	int i,n,m,x,y;

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

	{

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

		{

			per[i]=i;

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

		}

		double sum=0;

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

		{

			scanf("%d%d",&x,&y);

			a[i].s=x;a[i].e=y;

			a[i].w=ma(p[x],p[y]);

			sum+=a[i].w;

		}

		sort(a,a+m,cmp);

		double tmp=0;

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

		{

			if(Judge(a[i].s,a[i].e))

				tmp+=a[i].w;

		}

		printf("%.3lf\n",sum-tmp);

	}

	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;

}