#include <bits/stdc++.h>
using namespace std;
struct pt {
  double x, y;
  int num;
  pt(double _x = 0, double _y = 0) : x(_x), y(_y) {}
  inline double abs() { return sqrt(x * x + y * y); }
};
inline pt operator-(const pt &p1, const pt &p2) {
  return pt(p1.x - p2.x, p1.y - p2.y);
}
const int maxn = (int)1e5;
pt ps[maxn];
struct setCompe {
  static vector<double> *dist;
  inline bool operator()(const int a, const int b) {
    return dist[a] != dist[b] ? dist[a] < dist[b] : a < b;
  }
};
vector<double> *setCompe::dist;
struct Graph {
  int n;
  vector<vector<int> > es;
  vector<vector<double> > myws;
  Graph(int _n = 0) : n(_n) {
    es = vector<vector<int> >(n);
    myws = vector<vector<double> >(n);
  }
  void adde(int s, int t, double w) {
    es[s].push_back(t), myws[s].push_back(w);
  }
  vector<double> dist;
  double dijkstra(int S, int T) {
    dist = vector<double>(n, ((int)1E9));
    dist[S] = 0;
    setCompe::dist = &dist;
    set<int> s;
    for (int i = 0; i < n; i++) s.insert(i);
    while (((int)(s).size())) {
      int v = *s.begin();
      s.erase(s.begin());
      for (int it = 0; it < ((int)(es[v]).size()); it++) {
        int u = es[v][it];
        if (dist[u] > dist[v] + myws[v][it] + (1E-9)) {
          s.erase(u);
          dist[u] = dist[v] + myws[v][it];
          s.insert(u);
        }
      }
    }
    return dist[T];
  }
};
struct segm {
  pt pl, pr;
  segm() {}
  segm(const pt &p1, const pt &p2) : pl(p1), pr(p2) {
    if (pl.x > pr.x) swap(pl, pr);
  }
  double find(double x) const {
    assert(pr.x - pl.x > (1E-9));
    return (x - pl.x) / (pr.x - pl.x) * (pr.y - pl.y) + pl.y;
  }
};
struct event {
  double x;
  int closed;
  int numsegm;
  inline bool operator<(const event &e) const {
    return fabs(x - e.x) > (1E-9) ? x < e.x : closed != e.closed ? !closed : 0;
  }
};
struct setComp {
  static double x;
  inline bool operator()(const segm &s1, const segm &s2) {
    double y1 = s1.find(x), y2 = s2.find(x);
    if (fabs(y1 - y2) > (1E-9)) return y1 < y2;
    if ((s1.pr.x + s1.pl.x >= 2 * x) == (s2.pr.x + s2.pl.x >= 2 * x)) {
      double curx1 = (s1.pl.x + s1.pr.x) / 2, curx2 = (s2.pl.x + s2.pr.x) / 2;
      double curx = abs(curx1 - x) < abs(curx2 - x) ? curx1 : curx2;
      return s1.find(curx) < s2.find(curx);
    }
    return s1.pr.x + s1.pl.x < s2.pl.x + s2.pr.x;
  }
};
double setComp::x = 0;
segm ss[maxn];
event evs[2 * maxn];
int main() {
  int n;
  while (scanf("%d", &n) >= 1) {
    for (int i = 0; i < n; i++) {
      scanf("%lf%lf", &ps[i].x, &ps[i].y);
      ps[i].num = i;
    }
    int S, T;
    scanf("%d%d", &S, &T);
    S--, T--;
    Graph g(n);
    int m = 0;
    for (int i = 0; i < n; i++) {
      int in = i == n - 1 ? 0 : i + 1;
      g.adde(i, in, (ps[i] - ps[in]).abs());
      g.adde(in, i, (ps[i] - ps[in]).abs());
      if (fabs(ps[i].x - ps[in].x) > (1E-9)) ss[m++] = segm(ps[i], ps[in]);
    }
    for (int i = 0; i < m; i++) {
      evs[2 * i].numsegm = evs[2 * i + 1].numsegm = i;
      evs[2 * i].x = ss[i].pl.x, evs[2 * i + 1].x = ss[i].pr.x;
      evs[2 * i].closed = 0, evs[2 * i + 1].closed = 1;
    }
    sort(evs, evs + 2 * m);
    set<segm, setComp> s;
    for (int i = 0; i < 2 * m;) {
      int i0 = i;
      while (i < 2 * m && !(evs[i0] < evs[i])) i++;
      setComp::x = evs[i0].x;
      if (!evs[i0].closed) {
        for (int j = i0; j < i; j++) s.insert(ss[evs[j].numsegm]);
      }
      for (int j = i0; j < i; j++) {
        const segm &cur = ss[evs[j].numsegm];
        int pushup = (cur.pl.num + 1 - cur.pr.num);
        if (pushup == n) pushup = 0;
        pushup = !pushup;
        set<segm, setComp>::iterator it;
        if (pushup) {
          it = s.upper_bound(cur);
          if (it == s.end()) continue;
        } else {
          it = s.lower_bound(cur);
          if (it == s.begin()) continue;
          it--;
        }
        segm beside = *it;
        double x = evs[j].x;
        double cury = cur.find(x), besy = beside.find(x);
        double distsegm = abs(cury - besy);
        pt pcur(x, besy);
        pcur.num = (fabs(cur.pl.x - x) < (1E-9) ? cur.pl.num : cur.pr.num);
        if (pushup) {
          g.adde(beside.pl.num, pcur.num, distsegm + (beside.pl - pcur).abs());
          g.adde(beside.pr.num, pcur.num, distsegm + (beside.pr - pcur).abs());
        } else {
          g.adde(pcur.num, beside.pl.num, distsegm + (beside.pl - pcur).abs());
          g.adde(pcur.num, beside.pr.num, distsegm + (beside.pr - pcur).abs());
        }
      }
      if (evs[i0].closed) {
        for (int j = i0; j < i; j++) s.erase(ss[evs[j].numsegm]);
      }
    }
    printf("%.18lf\n", g.dijkstra(S, T));
  }
  return 0;
}
