import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 2); int n = Integer.parseInt(first[0]); int m = Integer.parseInt(first[1]); String[] second = br.readLine().split(" ", 2); int x = Integer.parseInt(second[0]) - 1; int y = Integer.parseInt(second[1]) - 1; ArrayList> graph = new ArrayList<>(); Node[] nodes = new Node[n]; for (int i = 0; i < n; i++) { String[] line = br.readLine().split(" ", 2); nodes[i] = new Node(i, Integer.parseInt(line[0]), Integer.parseInt(line[1])); graph.add(new ArrayList<>()); } for (int i = 0; i < m; i++) { String[] line = br.readLine().split(" ", 2); int a = Integer.parseInt(line[0]) - 1; int b = Integer.parseInt(line[1]) - 1; graph.get(a).add(b); graph.get(b).add(a); } double[] costs = new double[n]; Arrays.fill(costs, Double.MAX_VALUE); PriorityQueue queue = new PriorityQueue<>(); queue.add(new Path(x, 0)); while (queue.size() > 0) { Path p = queue.poll(); if (costs[p.idx] <= p.value) { continue; } costs[p.idx] = p.value; for (int next : graph.get(p.idx)) { queue.add(new Path(next, p.value + nodes[next].getDistance(nodes[p.idx]))); } } System.out.println(costs[y]); } static class Path implements Comparable { int idx; double value; public Path(int idx, double value) { this.idx = idx; this.value = value; } public int compareTo(Path another) { if (value == another.value) { return 0; } else if (value < another.value) { return -1; } else { return 1; } } } static class Node { int idx; int x; int y; public Node(int idx, int x, int y) { this.idx = idx; this.x = x; this.y = y; } public double getDistance(Node another) { return Math.sqrt(Math.pow(x - another.x, 2) + Math.pow(y - another.y, 2)); } public int hashCode() { return idx; } public boolean equals(Object o) { Node n = (Node)o; return idx == n.idx; } } }