import numpy as np from scipy.sparse import csr_matrix from scipy.sparse.csgraph import shortest_path import sys def main(): input = lambda: sys.stdin.readline()[:-1] N, M = map(int, input().split()) X, Y = map(int, input().split()) pq = np.array([input().split() for _ in [0] * N], dtype=np.int64) PQ = np.transpose(np.fromstring(sys.stdin.read(), dtype=np.int64, sep=" ").reshape(-1, 2)) func = np.vectorize(lambda p, q: np.linalg.norm([pq[p - 1] - pq[q - 1]])) dist = func(PQ[0], PQ[1]) csr = csr_matrix((dist, PQ), (N + 1, N + 1)) ans = shortest_path(csr, indices=X, directed=False) print(ans[Y]) if not __debug__: f = open(sys.argv[1], "r") sys.stdin = f # try: # sys.set_int_max_str_digits(100000) # except AttributeError: # pass main()