import heapq N,M = map(int, input().split()) X,Y = map(int, input().split()) L = [[int(l) for l in input().split()] for _ in range(N)] E = [[] for _ in range(N)] for _ in range(M): p,q = map(int, input().split()) p -= 1 q -= 1 d = ((L[p][0]-L[q][0])**2 + (L[p][1]-L[q][1])**2)**0.5 E[p].append((q, d)) E[q].append((p, d)) def dijkstra(s): used = [0]*N inf = 10**10 d = [inf]*N h = [(0, s)] while h: temp = heapq.heappop(h) u = temp[1] r = temp[0] if used[u] == 1: continue d[u] = r used[u] = 1 for e in E[u]: if used[e[0]] == 1: continue heapq.heappush(h, (r+e[1], e[0])) return d[Y-1] ans = dijkstra(X-1) print(ans)