#include #define all(vec) vec.begin(), vec.end() #define pb push_back #define eb emplace_back #define fi first #define se second using namespace std; using ll = long long; using P = pair; template using V = vector; template inline void chmin(T &a, const T &b) { a = min(a, b); } template inline void chmax(T &a, const T &b) { a = max(a, b); } template inline bool kbit(const T &x, const int &k) { return ((x >> k) & 1LL); } inline int popcount(const int &n) { return __builtin_popcount(n); } inline ll popcountll(const ll &n) { return __builtin_popcountll(n); } template void zip(V &v) { sort(all(v)); v.erase(unique(all(v)), v.end()); } void dump() { cerr << '\n'; } template void dump(Head &&head, Tail &&... tail) { cerr << head << (sizeof...(Tail) == 0 ? " " : ", "); dump(std::move(tail)...); } template void print(const vector &v) { for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' '); } template void read(vector &v) { for (int i = 0; i < v.size(); i++) cin >> v[i]; } constexpr char sp = ' ', newl = '\n'; constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; constexpr ll INF = (1LL << 30) - 1LL; constexpr ll MOD = 1e9 + 7; //@docs Docs/Dijkstra.md template struct Dijkstra { int n; vector>> G; Dijkstra(int n) : n(n), G(n) {} void addedge(const int &u, const int &v, const T &c) { G[u].emplace_back(v, c); } vector dijkstra(const int &st) { priority_queue, vector>, greater>> q; vector d(n, INF); d[st] = 0; q.emplace(0, st); while (!q.empty()) { int v = q.top().second; T dd = q.top().first; q.pop(); if (d[v] < dd) continue; for (auto &e : G[v]) { if (d[e.first] > d[v] + e.second) { d[e.first] = d[v] + e.second; q.emplace(d[e.first], e.first); } } } return d; } }; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; int a, b; cin >> a >> b; --a; --b; V x(n), y(n); for (int i = 0; i < n; i++) { cin >> x[i] >> y[i]; } Dijkstra g(n); for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; --u; --v; double d = sqrt(pow(x[u] - x[v], 2) + pow(y[u] - y[v], 2)); g.addedge(u, v, d); g.addedge(v, u, d); } cout << fixed << setprecision(15) << g.dijkstra(a)[b] << newl; }