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<cmath>
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

const double eps = 1e-6;
int sgn(double x){
    if(abs(x) < eps) return 0;
    else return x > 0 ? 1 : - 1;
}
struct Point{
    double x, y;
    Point(){};
    Point(double x1, double y1){
        x = x1, y = y1;
    }
};
typedef Point Vector;

int n;
Point p[1024], s1, s2, news2, news1;
int v1, v2;
Point readp(){
    int x, y;
    scanf("%d%d",&x,&y);
    return Point(x, y);
}

Vector operator + (Vector a, Vector b){
    return Vector(a.x + b.x, a.y + b.y);
}
Vector operator - (Vector a, Vector b){
    return Vector(a.x - b.x, a.y - b.y);
}
double operator % (Vector a, Vector b){
    return a.x * b.y - a.y * b.x;
}
double operator * (Vector a, Vector b){
    return a.x * b.x + a.y * b.y;
}
Vector operator / (Vector a, double b){
    return Vector(a.x / b, a.y / b);
}
Vector operator * (Vector a, double b){
    return Vector(a.x * b, a.y * b);
}
bool operator == (Point a, Point b){
    return sgn(a.x - b.x) == 0 && sgn(a.y - b.y) == 0;
}
bool PoiOnSeg(Point p, Point p1, Point p2){
    if(sgn((p - p1) % (p - p2)) != 0) return false;
    if(sgn((p1 - p) * (p2 - p)) > 0) return false;
    else return true;
}
double Length(Vector v){
    return sqrt(v.x * v.x + v.y * v.y);
}
double Len2(Vector v){
    return v.x * v.x + v.y * v.y;
}
Vector Unitv(Vector v){
    return v / Length(v);
}

int findf(Point s1){
    int f = n + 10;
    for(int i = 0; i + 1 < n; i++){
        if(PoiOnSeg(s1, p[i], p[i + 1]))
        {
            f = min(f, i);
        }
    }
    return f;
}

double ans;
void maxtime(Point s1, double &maxt1, double &maxt2){
    maxt1 = 0;
    Point nowp = s1;
    int f = findf(s1);
    for(int i = f + 1; i < n; i++){
        maxt1 += Length(nowp - p[i]);
        nowp = p[i];
    }
    nowp = s1;
    maxt2 = 0;
    for(int i = f; i >= 0; i--){
        maxt2 += Length(nowp - p[i]);
        nowp = p[i];
    }
    
    maxt1 /= v1;
    maxt2 /= v1;
}

Point getto(Point s1, double t, int dir){
    double nowt = 0;
    Point nowp = s1;
    int f = findf(nowp);
    if(dir == 1)
    {
        for(int i = f + 1; i < n; i++){
            if(nowp == p[i]) continue;
            double needt = Length(nowp - p[i]) / v1;
            if(sgn(nowt + needt - t) >= 0){
                nowp = nowp + Unitv(p[i] - nowp) * (t - nowt) * v1;
                break;
            }
            else{
                nowt += needt;
                nowp = p[i];
            }
        }
    }
    else
    {
        for(int i = f; i >= 0; i--){
            if(nowp == p[i]) continue;
            double needt = Length(nowp - p[i]) / v1;
            if(sgn(nowt + needt - t) >= 0){
                nowp = nowp + Unitv((p[i] - nowp)) * (t - nowt) * v1;
                break;
            }
            else{
                nowt += needt;
                nowp = p[i];
            }
        }
    }
    return nowp;
}

bool PoiInCir(Point p, Point c, double r){
    return sgn(Len2(p - c) - r * r) <= 0;
}

double solve(Point sta, Point aim, double maxt, int dir){
    double l = 0.0, r = maxt, mid;
    int tt = 100;
    while(r - l > 1e-10 && tt--){
        mid = (l + r) * 0.5;
        Point p1 = getto(aim, mid, dir);
        if(PoiInCir(p1, sta, mid * v2)) r = mid;
        else l = mid;
    }
    return l;
}

double solve1(){
    double maxt1, maxt2, t1, t2;
    
    maxtime(s1, maxt1, maxt2);
    t1 = solve(s2, s1, maxt1, 1);
    if(sgn(t1 - maxt1) == 0) return 1e20;
    news2 = getto(s1, t1, 1);
    news1 = getto(s1, t1, 2);
    
    if(sgn(t1 - maxt2) >= 0) return t1;
    
    maxtime(news1, maxt1, maxt2);
    
    t2 = solve(news2, news1, maxt2, 2);
    
    return t1 + t2;
}

double solve2(){
    double maxt1, maxt2, t1, t2;
    
    maxtime(s1, maxt1, maxt2);
    t2 = solve(s2, s1, maxt2, 2);
    if(sgn(t2 - maxt2) == 0) return 1e20;
    news2 = getto(s1, t2, 2);
    news1 = getto(s1, t2, 1);
    
    if(sgn(t2 - maxt1) >= 0) return t2;
    
    maxtime(news1, maxt1, maxt2);
    
    t1 = solve(news2, news1, maxt1, 1);
    
    return t1 + t2;
}

int main(){
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        p[i] = readp();
    }
    s1 = readp(); scanf("%d",&v1);
    s2 = readp(); scanf("%d",&v2);
    
    double maxt1, maxt2;
    maxtime(s1, maxt1, maxt2);
    
    double ans = min(solve1(), solve2());
    ans = min(ans, max(maxt1, maxt2));
    printf("%.10f\n", ans);
    return 0;
}