import heapq N,M = map(int,input().split()) X,Y = map(int,input().split()) X,Y = X-1,Y-1 lsP = [] for i in range(N): p,q = map(int,input().split()) lsP.append((p,q)) lsG = [[] for i in range(N)] for i in range(M): P,Q = map(int,input().split()) P -= 1 Q -= 1 dist = ((lsP[P][0]-lsP[Q][0])**2+(lsP[P][1]-lsP[Q][1])**2)**(1/2) lsG[P].append((Q,dist)) lsG[Q].append((P,dist)) used = [False]*(N) inf = float('INF') lscost = [inf]*(N) lscost[X] = 0 h = [(0,X)] while h: c,n = heapq.heappop(h) if used[n]: continue used[n] = True for j,cost in lsG[n]: if used[j]: continue if lscost[j] > lscost[n] + cost: lscost[j] = lscost[n] + cost heapq.heappush(h, (lscost[j],j)) print(lscost[Y])