from heapq import heappush, heappop N, M = map(int, input().split()) X, Y = map(int, input().split()) p = [list(map(int, input().split())) for _ in range(N)] D = {} DD = {} for i in range(M): P, Q = map(int, input().split()) if P-1 in D: D[P-1].append(Q-1) else: D[P-1] = [Q-1] if Q-1 in D: D[Q-1].append(P-1) else: D[Q-1] = [P-1] DD[(P-1)*N+(Q-1)] = ((p[P-1][0]-p[Q-1][0])**2+(p[P-1][1]-p[Q-1][1])**2) ** 0.5 DD[(Q-1)*N+(P-1)] = ((p[P-1][0]-p[Q-1][0])**2+(p[P-1][1]-p[Q-1][1])**2) ** 0.5 dist = [int(1e18) for _ in range(N)] dist[X-1] = 0 pq = [] for i in range(N): heappush(pq, [dist[i], i]) while pq != []: b = heappop(pq) r = b[1] if r in D: for i in D[r]: if dist[i] > dist[r] + DD[r*N+i]: dist[i] = dist[r] + DD[r*N+i] heappush(pq, [dist[i], i]) print(dist[Y-1])