import sys from scipy.sparse import coo_matrix from scipy.sparse.csgraph import shortest_path def input(): return sys.stdin.readline()[:-1] def main(): N, M = map(int, input().split()) X, Y = map(int, input().split()) p, q = zip(*[map(int, input().split()) for _ in [0] * N]) P, Q = zip(*[map(int, input().split()) for _ in [0] * M]) dis = [] apnd = dis.append for i, j in zip(P, Q): apnd((p[j - 1] - p[i - 1]) ** 2 + (q[j - 1] - q[i - 1]) ** 2) coo = coo_matrix((dis, (P, Q)), (N + 1, N + 1)) csr = coo.tocsr() ans = shortest_path(csr, indices=X, directed=False) print(ans[Y] ** 0.5) if not __debug__: f = open(sys.argv[1], "r") sys.stdin = f main()