#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdio>
using namespace std;
const double eps = 1e-4;
const int max_v = 1e4;
struct edge {int u, v; double cost;};
bool comp(const edge &e1, const edge &e2) {
    return e1.cost > e2.cost;
}
struct Point{int x, y;};
Point p[max_v + 10];
vector <edge> es;
int n, m;
int par[max_v + 10], ranks[max_v + 10];
inline double dst(Point p1, Point p2) {
    int x1 = p1.x, y1 = p1.y;
    int x2 = p2.x, y2 = p2.y;
    int d1 = x1 - x2, d2 = y1 - y2;
    return sqrt(d1 * d1 * 1.0 + d2 * d2 * 1.0);
};
int find(int a) {
    if (par[a] == a) return a;
    int r = find(par[a]);
    par[a] = r;
    return r;
}

void unite(int a, int b) {
    int r1 = find(a);
    int r2 = find(b);
    if (r1 == r2) return ;
    if (ranks[r1] > ranks[r2]) {
        par[r2] = r1;
        ranks[r1] += ranks[r2];
    } else {
        par[r1] = r2;
        ranks[r2] += ranks[r1];
    }
}
bool same(int a, int b) {
    return find(a) == find(b);
}
double Kruskal() {
    sort(es.begin(), es.end(), comp);
    for (int i = 1; i <= n; i++) {
        par[i] = i;
        ranks[i] = 0;
    }
    double res = 0;
    for (auto e : es) {
        if (!same(e.u, e.v)) {
            unite(e.u, e.v);
            res += e.cost;
        }    
    }
    return res;
}
int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) 
        scanf("%d%d", &p[i].x, &p[i].y);
    
    double totW = 0;
    for (int i = 0; i < m; i++) {
        int p1, p2;
        scanf("%d%d", &p1, &p2);
        double d = dst(p[p1], p[p2]);
        es.push_back(edge{p1, p2, d});
        totW += d;
    }
    printf("%.3lf\n", totW - Kruskal());
    return 0;
}



