#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
struct node{
    double x,y;
}ver[10010];
struct Edge{
    int u,v;
    double l;
}e[1000000];
int n,m;
int pre[10010];
int Find(int x){
    if(x == pre[x])
        return x;
    else return pre[x] = Find(pre[x]);
}
int Union(int x,int y){
    int fx = Find(x),fy = Find(y);
    if(fx == fy)
        return 0;
    else{
        pre[fy] = fx;
        return 1;
    }
}
bool cmp(Edge a,Edge b){
    return a.l > b.l;
}
int main(){
    int i,j;
    cin >> n >> m;
    for(i = 0; i < 10010; i++)
        pre[i] = i;
    for(i = 1; i <= n; i++){
        cin >> ver[i].x >> ver[i].y;
    }
    double allsum = 0.0;
    for(i = 0; i < m; i++){
        int u,v;
        double len;
        cin >> u >> v;
        len = sqrt((ver[u].x-ver[v].x)*(ver[u].x-ver[v].x)+(ver[u].y-ver[v].y)*(ver[u].y-ver[v].y));
        e[i].u = u;
        e[i].v = v;
        e[i].l = len;
        allsum += len;
    }
    //cout << allsum << endl;
    sort(e,e+m,cmp);
    double sum = 0.0;
    int num = 0;
    for(i = 0; i < m; i++){
        if(Union(e[i].u,e[i].v)){
            sum += e[i].l;
            num++;
        }
        if(num == n-1)
            break;
    }
    //cout << sum << endl;
    printf("%.3f\n",allsum-sum);
    return 0;
}