from heapq import heappop, heappush n,m = map(int,input().split()) x,y = map(int,input().split()) x,y = x-1,y-1 PQ = [list(map(int,input().split())) for i in range(n)] e = [[] for i in range(n)] for _ in range(m): p,q = [int(i)-1 for i in input().split()] x1,y1 = PQ[p] x2,y2 = PQ[q] dis = ((x1-x2)**2+(y1-y2)**2)**0.5 e[p].append((q,dis)) e[q].append((p,dis)) inf = 10**10 dis = [inf]*n dis[x] = 0 h = [[0,x]] while h: d,now = heappop(h) if dis[now] != d: continue for nex,c in e[now]: if dis[nex] > d+c: dis[nex] = d+c heappush(h,[d+c,nex]) print(dis[y])