#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<queue>
#include<cstdio>
using namespace std;
#define inf 0x3f3f3f3f
#define pr(x) cout<<"x="<<x<<endl;
#define maxn 1000100
int N, M;
int par[maxn];
int x[maxn], y[maxn];
struct point{
	int ls, rs;
	double cost;
}p[maxn];


bool comp(point a, point b){ return a.cost>b.cost; }

int find(int x)
{
	if (x == par[x])return x;
	 return par[x] = find(par[x]);
}

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

double kru(int n, int e)
{
	for (int i = 1; i <= n; i++)par[i] = i;
	sort(p, p + e, comp);
	
	double ans = 0;
	for (int i = 0; i <e; i++)
	{
		int x = find(p[i].ls);
		int y = find(p[i].rs);
		if (x != y)
		{
			ans += p[i].cost;
			par[x] = y;
		}
	}
	return ans;
}

int main()
{
	double ans = 0;
	cin >> N >> M;
	for (int i = 1; i <= N; i++)
		scanf("%d%d", &x[i], &y[i]);

	for (int i = 0; i <M; i++){
		cin >> p[i].ls >> p[i].rs;
		int a = p[i].ls;
		int b = p[i].rs;
		int xx = x[a] - x[b]; 
		xx *= xx;
		int yy = y[a] - y[b]; 
		yy *= yy;
		p[i].cost = sqrt(xx + yy);
		ans += p[i].cost;
	}
	ans -= kru(N, M);
	printf("%.3f\n", ans);
}