#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
struct node{
    int x,y;
}no[10005];
struct edge{
    int from,to;
    double dis;
}ed[200000];
bool cmp(const edge &a,const edge &b){
    return a.dis>b.dis;
}
int father[10005];
int find(int who){
    if(who==father[who]) return who;
    else return father[who]=find(father[who]);
}
int main(void){
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>no[i].x>>no[i].y;
        father[i]=i;
    }
    double ans=0;
    for(int i=1;i<=m;i++){
        int a,b;
        cin>>a>>b;
        ed[i].from=a;
        ed[i].to=b;
        ed[i].dis= pow(pow(no[a].x-no[b].x,2)+pow(no[a].y-no[b].y,2),0.5);
        ans+=ed[i].dis;
    }
    //cout<<ans<<endl;
    sort(ed+1,ed+1+m,cmp);
    for(int i=1;i<=m;i++){
        int x=find(ed[i].from);
        int y=find(ed[i].to);
        if(x!=y){
            if(x<y)
                father[x]=father[y];
            else
                father[y]=father[x];
            ans-=ed[i].dis;
            //cout<<ed[i].dis<<":  "<<ed[i].from<<"---"<<ed[i].to<<endl;
            //for(int j=1;j<=n;j++)
            //    cout<<father[j]<<" ";
            //cout<<endl;
        }
    }
    printf("%.3lf",ans);
    return 0;
}