import sys input = sys.stdin.readline from heapq import heappop, heappush def main(): N, M = map( int, input().split()) X, Y = map( int, input().split()) X -= 1 Y -= 1 PQ = [ tuple( map( int, input().split())) for _ in range(N)] E = [[] for _ in range(N)] for _ in range(M): p, q = map( lambda x: int(x)-1, input().split()) E[p].append((q, ((PQ[p][0]-PQ[q][0])**2 + (PQ[p][1]-PQ[q][1])**2)**(1/2))) E[q].append((p, ((PQ[p][0]-PQ[q][0])**2 + (PQ[p][1]-PQ[q][1])**2)**(1/2))) h = [(0,X)] V = [-1 for _ in range(N)] # W = [False for _ in range(N)] # V[X] = 0 # W[X] = True while h: d, v = heappop(h) if V[v] == -1: V[v] = d else: continue for w, e in E[v]: if V[w] == -1: heappush(h, (d+e, w)) # print(h) print(V[Y]) if __name__ == '__main__': main()