#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

int per[20000+10];
struct node
{
	int a;
	int b;
	double edge;
 };
 node es[10000+10];
 bool cmp(node x,node y)
 {
 	return x.edge>y.edge;
 }
 int find(int x)
 {
 	if(per[x]==x)
 		return x;
 	return per[x]=find(per[x]);
 }
 int merge(int x,int y)
 {
 	int fx=find(x);
 	int fy=find(y);
 	if(fx!=fy)
 	{
 		per[fx]=fy;
 		return 1;
	 }
	 return 0;
 }
 double ans;
 double kruskal(int n,int m)
 {
 	sort(es,es+m,cmp);
 	ans=0;
 	int cnt=0;
 	for(int i=0;i<m&&cnt<n-1;i++)
 	{
 		if(merge(es[i].a,es[i].b))
 		{
 			ans+=es[i].edge;
 			cnt++;
		 }

	 }
	 return ans;
 }
 int main()
 {
 	int n,m;
 	double pointx[10000+10],pointy[10000+10];
 	while(~scanf("%d%d",&n,&m))
 	{
 		for(int i=1;i<=n;i++)
 		{
 			per[i]=i;
		 }
 		double sum=0.0;
 		for(int i=1;i<=n;i++)
 			scanf("%lf%lf",&pointx[i],&pointy[i]);
 		for(int i=0;i<m;i++)
 		{
 			scanf("%d%d",&es[i].a,&es[i].b);
 			es[i].edge=sqrt((pointx[es[i].a]-pointx[es[i].b])*(pointx[es[i].a]-pointx[es[i].b])+(pointy[es[i].a]-pointy[es[i].b])*(pointy[es[i].a]-pointy[es[i].b]));
 			sum+=es[i].edge;
		 }
		 printf("%.4lf\n",sum-kruskal(n,m));
	 }
	 return 0;
 }