import heapq import math import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N, M = map(int, input().split()) S, T = map(int, input().split()) xy = tuple(tuple(map(int, input().split())) for _ in range(N)) edge = [[] for _ in range(N + 1)] for _ in range(M): p, q = map(int, input().split()) x1, y1 = xy[p - 1] x2, y2 = xy[q - 1] d = math.hypot(x1 - x2, y1 - y2) edge[p].append((q, d)) edge[q].append((p, d)) inf = 10**18 dist = [inf] * (N + 1) dist[S] = 0 que = [(0, S)] while que: c, s = heapq.heappop(que) if dist[s] < c: continue cost = dist[s] for t, d in edge[s]: if dist[t] > cost + d: dist[t] = cost + d heapq.heappush(que, (cost+d, t)) print(dist[T])