N,M=map(int,input().split()) X,Y=map(int,input().split()) L=[tuple(map(int,input().split())) for i in range(N)] E=[[] for i in range(N+1)] from math import sqrt for i in range(M): p,q=map(int,input().split()) p-=1 q-=1 x0,y0=L[p] x1,y1=L[q] E[p].append((sqrt((x0-x1)**2+(y0-y1)**2),q)) E[q].append((sqrt((x0-x1)**2+(y0-y1)**2),p)) import heapq DP=[1<<62]*(N+1) DP[X-1]=0 Q=[(0,X-1)] while Q: now,x=heapq.heappop(Q) for le,to in E[x]: if DP[to]>DP[x]+le: DP[to]=DP[x]+le heapq.heappush(Q,(DP[to]+le,to)) print(DP[Y-1])