FAST_IO = 1 if FAST_IO: import io, sys, atexit rr = iter(sys.stdin.read().splitlines()).next sys.stdout = _OUTPUT_BUFFER = io.BytesIO() @atexit.register def write(): sys.__stdout__.write(_OUTPUT_BUFFER.getvalue()) else: rr = raw_input rri = lambda: int(rr()) rrm = lambda: map(int, rr().split()) #### from collections import defaultdict as ddic import heapq def solve(N,M,X,Y,A,B): # A: powerpole locations # B: wires # Shortest path X to Y graph = ddic(list) for u, v in B: graph[u].append(v) graph[v].append(u) def dist_2d(u, v): x1, y1 = A[u - 1] x2, y2 = A[v - 1] return ((x1-x2)**2 + (y1-y2)**2)**0.5 INF = float('inf') dist = ddic(lambda: INF) dist[X] = 0 pq = [[0, X]] while pq: d, node = heapq.heappop(pq) if d > dist[node]: continue for nei in graph[node]: w = dist_2d(node, nei) d2 = d + w if d2 < dist[nei]: dist[nei] = d2 heapq.heappush(pq, [d2, nei]) return dist[Y] N,M = rrm() X,Y = rrm() A = [rrm() for _ in xrange(N)] B = [rrm() for _ in xrange(M)] print solve(N, M, X, Y, A, B)