//
//  main.cpp
//

#include <iostream>
//#include <algorithm>
#include <vector>
//#include <limits>
#include <math.h>
//#include <queue>
//#include <tuple>
//#include <stdio.h>
//#include <stdlib.h>
//#include <string>
//#include "string.h"
// #include <unordered_map>
#include <map>
#include <unordered_set>
//#include <array>
#include <set>
#include <limits>

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2224

using namespace std;

using ll = long long;

#include <vector>

struct UnionFind {
    vector<size_t> parent;
    vector<size_t> rank;
    size_t findParent(size_t x) {
        if (parent[x] == x) {
            return x;
        } else {
            parent[x] = findParent(parent[x]);
            return parent[x];
        }
    }
    explicit UnionFind(size_t size) {
        parent.resize(size);
        rank.resize(size);
        for (size_t i = 0; i < size; i++) {
            parent[i] = i;
            rank[i] = 0;
        }
    }
    virtual ~UnionFind() {}
    void unite(size_t x, size_t y) {
        size_t px = findParent(x);
        size_t py = findParent(y);
        if (px == py) {
            return;
        }
        if (rank[px] < rank[py]) {
            parent[px] = py;
        } else if (rank[px] > rank[py]) {
            parent[py] = px;
        } else { // rank[px] == rank[py]
            parent[py] = px;
            rank[px]++;
        }
    }
    bool isSame(size_t x, size_t y) {
        return findParent(x) == findParent(y);
    }
};

int main() {
    int N, M;
    cin >> N >> M;
    struct Pl {
        int x;
        int y;
        Pl(int x, int y) : x(x), y(y) {}
        double dist(const Pl& rhs) const {
            return sqrt(pow((double)(x - rhs.x), 2.0) + pow((double)(y - rhs.y), 2.0));
        }
    };
    vector<Pl> piles;
    piles.reserve(N);
    for (int i = 0; i < N; i++) {
        int x, y;
        cin >> x >> y;
        piles.emplace_back(x, y);
    }
    struct Fc {
        int a;
        int b;
        double len;
        Fc(int a, int b, double len) : a(a), b(b), len(len) {}
        static bool compareLen(const Fc& lhs, const Fc& rhs) {
            return lhs.len > rhs.len;
        }
    };
    vector<Fc> fences;
    fences.reserve(M);
    double totalLen = 0.0;
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        double len = piles[a].dist(piles[b]);
        fences.emplace_back(a, b, len);
        totalLen += len;
    }
    sort(fences.begin(), fences.end(), Fc::compareLen);
    UnionFind uf(N);
    double lenSum = 0.0;
    for (Fc fc : fences) {
        if (!uf.isSame(fc.a, fc.b)) {
            uf.unite(fc.a, fc.b);
            lenSum += fc.len;
        }
    }
    cout << totalLen - lenSum << endl;
    return 0;
}

