#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<stack>
#define INF 1000000000
#define M 10005
#define LL long long
using namespace std;
struct node{
    int x,y;
    double z;
};
node B[M];
vector<node>A;
int fa[M];
double dis(int x,int y){
    int dx=B[x].x-B[y].x,dy=B[x].y-B[y].y;
    return sqrt(dx*dx+dy*dy);
}
int get(int x){
    if(fa[x]==x) return x;
    else return fa[x]=get(fa[x]);
}
bool cmp(node a,node b){
    return a.z>b.z;
}
int main(){
    int n,m;
    while(scanf("%d%d",&n,&m)!=EOF){
        int j,k;
        A.clear();
        for(j=1;j<=n;j++){
            fa[j]=j;
        }
        for(j=1;j<=n;j++) scanf("%d%d",&B[j].x,&B[j].y);
        double ans=0;
        for(j=1;j<=m;j++){
            int x,y;
            scanf("%d%d",&x,&y);
            double z=dis(x,y);
            //printf("%f\n",z);
            ans+=z;
            A.push_back((node){x,y,z});
        }
        sort(A.begin(),A.end(),cmp);
        for(j=0;j<A.size();j++){
            int a=get(A[j].x),b=get(A[j].y);
            if(a!=b){
                fa[a]=b;
                ans-=A[j].z;
            }
        }
        printf("%.3f\n",ans);
    }
    return 0;
}