from math import sqrt def dist(p,q): return sqrt((p[0]-q[0])**2+(p[1]-q[1])**2) class A: def __init__(self,d,x): self.d=d self.x=x def __le__(self,other): return self.d<=other.d def __lt__(self,other): return self.d<other.d def __iter__(self): yield from (self.d,self.x) #================================================ import sys from heapq import heappop,heappush input=sys.stdin.readline N,M=map(int,input().split()) X,Y=map(int,input().split()) Pos=[("*","*")] for _ in range(N): x,y=map(int,input().split()) Pos.append((x,y)) E=[set() for _ in range(N+1)] for _ in range(M): p,q=map(int,input().split()) E[p].add(q) E[q].add(p) inf=float("inf") T=[inf]*(N+1) T[X]=0 Q=[A(0,X)] while Q: c,p=heappop(Q) if T[p]<c: continue for q in E[p]: if T[q]>c+dist(Pos[p],Pos[q]): T[q]=c+dist(Pos[p],Pos[q]) heappush(Q,A(c+dist(Pos[p],Pos[q]),q)) print(T[Y])