#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>

using namespace std;
const int maxn=1e4+7;
int N, M;
int x[maxn], y[maxn];
int p[maxn];
int cnt;
struct edge
{
    int u, v, cost;
};
vector<edge> es;
int p[maxn];
void init()
{
    for(int i=0;i<=N;i++) p[i]=i;
}
int find(int x)
{
    if(p[x]==x) return x;
    else return p[x]=find(p[x]);
}
int kruskal()
{
    sort(es, es+M);
    init();
    int res=0;
    for(int i=0;i<M;i++){
        edge e=es[i];
        int x=find(e.u);
        int y=find(e.v);
        if(x!=y){
            p[x]=y;
            res+=e.cost;
            cnt++;
        }
    }
    return -res;
}
void solve()
{
    ans=ans-kruskal();
    if(cnt!=N-1) ans=0.000;
    printf("%.3lf\n", sqrt(ans));
}
int main()
{
    cin>>N>>M;
    for(int i=0;i<N;i++){
        cin>>x[i]>>y[i];
    }
    for(int i=0;i<M;i++){
        edge t;
        cin>>t.u>>t.v;
        t.cost=(x[u-1]-x[v-1])*(x[u-1]-x[v-1])+(y[u-1]-y[v-1])*(y[u-1]-y[v-1]);
        ans+=t.cost;
        t.cost=-t.cost;
        es.push_back(t);
    }
    solve();
}