import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from math import sqrt from scipy.sparse import csr_matrix from scipy.sparse.csgraph import dijkstra n, m = map(int, readline().split()) x, y = map(int, readline().split()) pq = [list(map(int, readline().split())) for _ in range(n)] graph = [[0] * (n + 1) for _ in range(n + 1)] for i in range(m): p, q = map(int, readline().split()) v = sqrt((pq[p - 1][0] - pq[q - 1][0]) ** 2 + (pq[p - 1][1] - pq[q - 1][1]) ** 2) graph[p][q] = v graph[q][p] = v print(dijkstra(csr_matrix(graph), indices=x)[y])