import math r=lambda:list(map(int,input().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=[X-1] t=[1e9]*N t[X-1]=0 while q: i=q.pop() for j in l[i]: a,b=p[i] c,d=p[j] k=t[i]+math.sqrt((a-c)*(a-c)+(b-d)*(b-d)) if k