Problem: ``Domino effect'' is a famous play using dominoes. A player sets up a chain of dominoes stood. After a chain is formed, the player topples one end of the dominoes. The first domino topples the second domino, the second topples the third and so on.

You are playing domino effect. Before you finish to set up a chain of domino, a domino block started to topple, unfortunately. You have to stop the toppling as soon as possible.

The domino chain forms a polygonal line on a two-dimensional coordinate system without self intersections. The toppling starts from a certain point on the domino chain and continues toward the both end of the chain. If the toppling starts on an end of the chain, the toppling continue toward the other end. The toppling of a direction stops when you touch the toppling point or the toppling reaches an end of the domino chain.

You can assume that:

* You are a point without volume on the two-dimensional coordinate system.
* The toppling stops soon after touching the toppling point.
* You can step over the domino chain without toppling it.



You will given the form of the domino chain, the starting point of the toppling, your coordinates when the toppling started, the toppling velocity and the your velocity. You are task is to write a program that calculates your optimal move to stop the toppling at the earliest timing and calculates the minimum time to stop the toppling.



Input

The first line contains one integer N, which denotes the number of vertices in the polygonal line of the domino chain (2 \leq N \leq 1000). Then N lines follow, each consists of two integers x_{i} and y_{i}, which denote the coordinates of the i-th vertex (-10,000 \leq x, y \leq 10000). The next line consists of three integers x_{t}, y_{t} and v_{t}, which denote the coordinates of the starting point and the velocity of the toppling. The last line consists of three integers x_{p}, y_{p} and v_{p}, which denotes the coordinates of you when the toppling started and the velocity (1 \leq v_{t} \lt v_{p} \leq 10). You may assume that the starting point of the toppling lies on the polygonal line.

Output

Print the minimum time to stop the toppling. The output must have a relative or absolute error less than 10^{-6}.

Examples

Input

2
0 0
15 0
5 0 1
10 10 2


Output

5.0


Input

3
-10 0
0 0
0 10
-1 0 1
3 0 2


Output

4.072027


Input

2
0 0
10 0
5 0 1
9 0 3


Output

2.0

Solution (in CPP):

Solution:
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

#include <complex>

typedef complex<double> Point;
typedef vector<Point> Polygon;

static const double INF = 1e+10;

#define CURR(P, i) (P[i])
#define NEXT(P, i) (P[(i + 1) % P.size()])

struct Line : public vector<Point> {
  Line() {;}
  Line(Point a, Point b) { push_back(a); push_back(b); }
};

struct Circle {
  Point p;
  double r;
  Circle() {;}
  Circle(Point p, double r) : p(p), r(r) {;}
};

namespace std {
  bool operator<(const Point &lhs, const Point &rhs) {
    return lhs.real() == rhs.real() ? lhs.imag() < rhs.imag() : lhs.real() < rhs.real();
  }
}

inline double cross(const Point &a, const Point &b) {
  return imag(conj(a) * b);
}

inline double dot(const Point &a, const Point &b) {
  return real(conj(a) * b);
}

inline int ccw(Point a, Point b, Point c) {
  b -= a;
  c -= a;
  if (cross(b, c) > 0) { return 1; }
  if (cross(b, c) < 0) { return -1; }
  if (dot(b, c) < 0) { return 2; }
  if (norm(b) < norm(c)) { return -2; }
  return 0;
}


bool intersectSS(const Line &s, const Line &t) {
  return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 &&
    ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0;
}

bool intersectSP(const Line &s, const Point &p) {
  return abs(s[0] - p) + abs(s[1] - p) - abs(s[1] - s[0]) < EPS;
}


double pv, dv;
struct Segs {
  vector<Line> lines;
  vector<double> sumDist;
  double AllTime() const { return sumDist.back() / dv; }
  Point pos(double t) const {
    if (t - AllTime() >= -EPS) { return lines.back()[1]; }
    Point ret;
    REP(i, sumDist.size()) {
      assert(i != (int)sumDist.size() - 1);
      if (t > sumDist[i + 1] / dv) { continue; }
      t -= sumDist[i] / dv;
      ret = lines[i][0];
      Point vect = lines[i][1] - lines[i][0];
      vect /= abs(vect);
      ret += vect * t * dv;
      break;
    }
    return ret;
  }
  Segs() {;}
};

int n;
double px, py;
double dx, dy;
Point ps[1010];
Segs segs[2];

double BiSearch(const Segs &segs, double startT, Point s) {
  double left = startT;
  double right = 1e+9;
  REP(iter, 200) {
    double mid = (left + right) / 2.0;
    Point p = segs.pos(mid);
    double d = abs(p - s);
    if (d / pv <= mid - startT) {
      right = mid;
    } else {
      left = mid;
    }
  }
  return left;
}

int main() {
  while (scanf("%d", &n) > 0) {
    segs[0] = Segs();
    segs[1] = Segs();
    REP(i, n) {
      double x, y;
      scanf("%lf %lf", &x, &y);
      ps[i] = Point(x, y);
    }
    scanf("%lf %lf %lf", &dx, &dy, &dv);
    scanf("%lf %lf %lf", &px, &py, &pv);
    REP(i, n - 1) {
      if (intersectSP(Line(ps[i], ps[i + 1]), Point(dx, dy))) {
        Point pp = Point(dx, dy);
        segs[0].sumDist.push_back(0);
        for (int j = i; j >= 0; j--) {
          segs[0].lines.push_back(Line(pp, ps[j]));
          double d = segs[0].sumDist.back() + abs(ps[j] - pp);
          segs[0].sumDist.push_back(d);
          pp = ps[j];
        }
        pp = Point(dx, dy);
        segs[1].sumDist.push_back(0);
        for (int j = i + 1; j < n; j++) {
          segs[1].lines.push_back(Line(pp, ps[j]));
          double d = segs[1].sumDist.back() + abs(ps[j] - pp);
          segs[1].sumDist.push_back(d);
          pp = ps[j];
        }
        break;
      }
      assert(i != n - 2);
    }
    double ans = max(segs[0].AllTime() , segs[1].AllTime());
    Point s = Point(px, py);
    {
      // 0 -> 1
      double t = BiSearch(segs[0], 0, s);
      Point np = segs[0].pos(t);
      ans = min(ans, BiSearch(segs[1], t, np));
    }
    {
      // 1 -> 0
      double t = BiSearch(segs[1], 0, s);
      Point np = segs[1].pos(t);
      ans = min(ans, BiSearch(segs[0], t, np));
    }
    {
      // 0
      ans = min(ans, max(BiSearch(segs[0], 0, s), segs[1].AllTime()));
    }
    {
      // 1
      ans = min(ans, max(BiSearch(segs[1], 0, s), segs[0].AllTime()));
    }
    printf("%.8f\n", ans);
  }
}