import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.PriorityQueue; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int n = Integer.parseInt(sa[0]); int m = Integer.parseInt(sa[1]); sa = br.readLine().split(" "); int x = Integer.parseInt(sa[0]) - 1; int y = Integer.parseInt(sa[1]) - 1; int[] p = new int[n]; int[] q = new int[n]; for (int i = 0; i < n; i++) { sa = br.readLine().split(" "); p[i] = Integer.parseInt(sa[0]); q[i] = Integer.parseInt(sa[1]); } List> list = new ArrayList<>(n); for (int i = 0; i < n; i++) { list.add(new ArrayList<>()); } for (int i = 0; i < m; i++) { sa = br.readLine().split(" "); int a = Integer.parseInt(sa[0]) - 1; int b = Integer.parseInt(sa[1]) - 1; double c = Math.hypot(p[a] - p[b], q[a] - q[b]); list.get(a).add(new Hen(b, c)); list.get(b).add(new Hen(a, c)); } br.close(); double[] d = new double[list.size()]; Arrays.fill(d, Double.MAX_VALUE); d[x] = 0; PriorityQueue que = new PriorityQueue(); Node first = new Node(x, 0); que.add(first); while (!que.isEmpty()) { Node cur = que.poll(); for (Hen hen : list.get(cur.v)) { double alt = d[cur.v] + hen.c; if (alt < d[hen.v]) { d[hen.v] = alt; Node next = new Node(hen.v, alt); que.add(next); } } } System.out.println(d[y]); } static class Hen { int v; double c; public Hen(int v, double c) { this.v = v; this.c = c; } } static class Node implements Comparable { int v; double d; public Node(int v, double d) { this.v = v; this.d = d; } public int compareTo(Node o) { return Double.compare(d, o.d); } } }