import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from math import sqrt def dijkstra_heap(s): import heapq # 始点sから各頂点への最短距離 d = [float("inf")] * n used = [True] * n # True:未確定 d[s] = 0 used[s] = False edgelist = [] for e in graph[s]: e.append(s) heapq.heappush(edgelist, e) while len(edgelist): minedge = heapq.heappop(edgelist) # まだ使われてない頂点の中から最小の距離のものを探す if not used[minedge[1]]: continue v = minedge[1] d[v] = minedge[0] used[v] = False for e in graph[v]: if used[e[1]]: heapq.heappush(edgelist, [e[0] + d[v], e[1]]) return d n, m = map(int, readline().split()) x, y = map(int, readline().split()) pq = [list(map(int, readline().split())) for _ in range(n)] graph = [[] for _ in range(n)] for i in range(m): p, q = map(int, readline().split()) p -= 1 q -= 1 v = sqrt((pq[p][0] - pq[q][0]) ** 2 + (pq[p][1] - pq[q][1]) ** 2) graph[p].append([v, q]) graph[q].append([v, p]) print(dijkstra_heap(x - 1)[y - 1])