using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Enu = System.Linq.Enumerable;

class Program
{
    void Solve()
    {
        int N = reader.Int(), M = reader.Int();
        var uf = new UnionFind(N);
        int[] x = new int[N], y = new int[N];
        var list = new List<Edge>();
        double ans = 0;

        for (int i = 0; i < N; i++)
        {
            x[i] = reader.Int(); y[i] = reader.Int();
        }
        for (int i = 0; i < M; i++)
        {
            int a = reader.Int() - 1, b = reader.Int() - 1;
            double cost = Dist(x[a], y[a], x[b], y[b]);
            ans += cost;
            list.Add(new Edge(cost, a, b));
        }
        foreach (var e in list.OrderByDescending(e => e))
        {
            if (!uf.Same(e.a, e.b))
            {
                ans -= e.cost;
                uf.Unite(e.a, e.b);
            }
        }
        Console.WriteLine(ans);
    }

    static double Dist(long x1, long y1, long x2, long y2)
    {
        return Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    }

    struct Edge : IComparable<Edge>
    {
        public double cost;
        public int a, b;
        public Edge(double cost, int a, int b)
        {
            this.cost = cost;
            this.a = a;
            this.b = b;
        }
        public int CompareTo(Edge other)
        {
            return Math.Sign(cost - other.cost);
        }
    }
    class UnionFind
    {
        int[] parent;
        int[] rank;

        public UnionFind(int V)
        {
            parent = new int[V];
            rank = new int[V];
            for (int i = 0; i < V; i++) { parent[i] = i; }
        }
        public int Root(int x)
        {
            if (parent[x] == x) return x;
            return parent[x] = Root(parent[x]);
        }
        public void Unite(int x, int y)
        {
            x = Root(x); y = Root(y);
            if (x == y) return;
            if (rank[x] < rank[y]) { parent[x] = y; }
            else
            {
                parent[y] = x;
                if (rank[x] == rank[y]) { rank[x]++; }
            }
        }
        public bool Same(int x, int y)
        {
            return Root(x) == Root(y);
        }
    }

    static void Main() { new Program().Solve(); }
    static Reader reader = new Reader(Console.In);
    class Reader
    {
        private readonly TextReader reader;
        private readonly char[] splitter = new char[] { ' ' };
        private string[] s = new string[0];
        private int i;
        public Reader(TextReader r) { reader = r; }
        public bool HasNext() { return Enqueue(); }
        public string String() { return Dequeue(); }
        public char Char() { return Dequeue()[0]; }
        public int Int() { return int.Parse(Dequeue()); }
        public long Long() { return long.Parse(Dequeue()); }
        public double Double() { return double.Parse(Dequeue()); }
        public int[] IntArray() { return Array.ConvertAll(Line().Split(), int.Parse); }
        public int[][] IntGrid(int H) { return Enumerable.Range(0, H).Select(i => IntArray()).ToArray(); }
        public string[] StringArray(int N) { return Enumerable.Range(0, N).Select(i => Line()).ToArray(); }
        public string Line() { return reader.ReadLine().Trim(); }
        private bool Enqueue()
        {
            if (i < s.Length) return true;
            string line = reader.ReadLine();
            if (string.IsNullOrEmpty(line)) return false;
            s = line.Split(splitter, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return true;
        }
        private string Dequeue() { Enqueue(); return s[i++]; }
    }
}

Measured memory_bytes: 20740