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

#include<queue>

#include<cstdio>

#include<vector>

#include<cstring>

#include<iostream>

#include<algorithm>

#define RG register

#define LL long long

#define fre(a) freopen(a".in","r",stdin);//freopen(a".out","w",stdout);

using namespace std;

const int MAXN=300000;

int n,m;

int X[MAXN],Y[MAXN],fa[MAXN];

double ans,ALL;

struct ed

{

   int from,to;

   double len;

}edge[MAXN];

bool comp(ed x,ed y){ return x.len>y.len; }

int find(int x)

{

   if(x!=fa[x])

      fa[x]=find(fa[x]);

   return fa[x];

}

void Union(int x,int y)

{

   x=find(x);

   y=find(y);

   fa[x]=y;

}

void work()

{

   int cnt=0;

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

      {

	 int A=edge[i].from,B=edge[i].to;

	 if(find(A)!=find(B))

	    {

	       Union(A,B);

	       ans+=edge[i].len;

	       cnt++;

	    }

	 if(cnt>=n-1)break;

      }

}

int main()

{

   //fre("1");

   scanf("%d%d",&n,&m);

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

      {

	 scanf("%d%d",&X[i],&Y[i]);

	 fa[i]=i;

      }

   for(int i=1,a,b;i<=m;i++)

      {

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

	 edge[i].from=a;

	 edge[i].to=b;

	 edge[i].len=sqrt((X[a]-X[b])*(X[a]-X[b])+(Y[a]-Y[b])*(Y[a]-Y[b]));

	 ALL+=edge[i].len;

      }

   sort(edge+1,edge+1+m,comp);

   work();

   ans=ALL-ans;

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

   return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>



using namespace std;



int n, m, f[10010], x[10010], y[10010];

double ans = 0.0;



struct edge {

	int u, v;

	double w;

	bool operator < (const edge &b) const { return w < b.w; }

}e[1000010];



double getdis(int u, int v) {

	return sqrt((double)(x[u] - x[v]) * (x[u] - x[v]) + (double)(y[u] - y[v]) * (y[u] - y[v]));

}



int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }



int main() {

	scanf("%d%d", &n, &m);

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

		f[i] = i;

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

	}

	int u, v;

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

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

		e[i].u = u;

		e[i].v = v;

		e[i].w = getdis(u, v);

	}

	sort(e + 1, e + m + 1);

	for(int i = m; i >= 1; --i) {

		int fu = find(e[i].u);

		int fv = find(e[i].v);

		if(fu != fv) f[fu] = fv;

		else ans += e[i].w;

	}

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

	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;

}