import sys from collections import deque r=lambda:list(map(int,sys.stdin.readline().split())) N,M=r() X,Y=r() p=[r()for _ in range(N)] P=[r()for _ in range(M)] l=[[]for _ in range(N)] for a,b in P: l[a-1].append(b-1) l[b-1].append(a-1) q=deque([X-1]) t=[9e9]*N t[X-1]=0 while q: i=q.popleft() for j in l[i]: a,b=p[i] c,d=p[j] k=t[i]+((a-c)*(a-c)+(b-d)*(b-d))**0.5 if k