from heapq import * N,M = map(int,input().split()) X,Y = map(int,input().split()) P = [list(map(int,input().split())) for _ in range(N)] E = [[] for _ in range(N)] for i in range(M): u,v = map(int,input().split()) u -= 1 v -= 1 d = ((P[u][0] - P[v][0]) ** 2 + (P[u][1] - P[v][1]) ** 2) ** 0.5 E[u].append((v,d)) E[v].append((u,d)) INF = 10 ** 10 def dijkstra(x,y): D = [INF] * N D[x] = 0 q = [(0,x)] while q: d, u = heappop(q) if d > D[u]: continue for a,b in E[u]: if D[a] > D[u] + b: D[a] = D[u] + b heappush(q, (D[a], a)) return D[y] print(dijkstra(X-1,Y-1))