N,M = map(int,input().split()) X,Y = map(int,input().split()) PQ = [list(map(int,input().split())) for i in range(N)] import heapq as hq q = [] hq.heappush(q, (0, X - 1)) G = [[] for i in range(N)] for _ in range(M): i,j = map(lambda x:int(x) - 1,input().split()) d = ((PQ[i][0] - PQ[j][0]) ** 2 + (PQ[i][1] - PQ[j][1]) ** 2) ** 0.5 G[i].append([j, d]) G[j].append([i, d]) visited = [False] * N while q: dist, v = hq.heappop(q) if visited[v]: continue visited[v] = True if v == Y - 1: print(dist) break for child, d in G[v]: if visited[child]: continue hq.heappush(q, (dist + d, child))