#!/usr/bin/env pypy3 import heapq import math INF = 10 ** 8 def dijkstra(num_vertices, adj_list, source=0): dist = [INF for _ in range(num_vertices)] dist[source] = 0 pq = [(dist[u], u) for u in range(num_vertices)] heapq.heapify(pq) while pq: _, u = heapq.heappop(pq) for v, cost in adj_list[u]: new_length = dist[u] + cost if new_length < dist[v]: dist[v] = new_length heapq.heappush(pq, (new_length, v)) return dist def minimize(n, adj_list, pole_start, pole_end): dist = dijkstra(n, adj_list, pole_start) res = dist[pole_end] return res def main(): n, m = (int(z) for z in input().split()) pole_start, pole_end = (int(z) - 1 for z in input().split()) pole_poss = [] for _ in range(n): x0, y0 = (float(z) for z in input().split()) pole_poss.append((x0, y0)) adj_list = [set() for _ in range(n)] for _ in range(m): st, en = (int(z) - 1 for z in input().split()) dist = math.hypot(pole_poss[st][0] - pole_poss[en][0], pole_poss[st][1] - pole_poss[en][1]) adj_list[st].add((en, dist)) adj_list[en].add((st, dist)) res = minimize(n, adj_list, pole_start, pole_end) print("{:.8f}".format(res)) if __name__ == '__main__': main()