import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int x = sc.nextInt() - 1; int y = sc.nextInt() - 1; Point[] points = new Point[n]; ArrayList> graph = new ArrayList<>(); for (int i = 0; i < n; i++) { points[i] = new Point(sc.nextInt(), sc.nextInt()); graph.add(new HashMap<>()); } for (int i = 0; i < m; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; double distance = points[a].getDistance(points[b]); graph.get(a).put(b, distance); graph.get(b).put(a, distance); } PriorityQueue queue = new PriorityQueue<>(); queue.add(new Path(x, 0)); boolean[] visited = new boolean[n]; double ans = 0; while (queue.size() > 0) { Path p = queue.poll(); if (visited[p.idx]) { continue; } visited[p.idx] = true; if (p.idx == y) { ans = p.value; break; } for (Map.Entry entry : graph.get(p.idx).entrySet()) { if (!visited[entry.getKey()]) { queue.add(new Path(entry.getKey(), p.value + entry.getValue())); } } } System.out.println(ans); } 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 Point { int x; int y; public Point(int x, int y) { this.x = x; this.y = y; } public double getDistance(Point p) { return Math.sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y)); } } }