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<math.h>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
const double EPS = 1e-7;
const double INF = 1e+10;
const double PI = acos(-1);
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
inline double ABS(double a){return max(a,-a);}
struct Pt {
    double x, y;
    Pt() {}
    Pt(double x, double y) : x(x), y(y) {}
    Pt operator+(const Pt &a) const { return Pt(x + a.x, y + a.y); }
    Pt operator-(const Pt &a) const { return Pt(x - a.x, y - a.y); }
    Pt operator*(const Pt &a) const { return Pt(x * a.x - y * a.y, x * a.y + y * a.x); }
    Pt operator-() const { return Pt(-x, -y); }
    Pt operator*(const double &k) const { return Pt(x * k, y * k); }
    Pt operator/(const double &k) const { return Pt(x / k, y / k); }
    bool operator==(const Pt &a)const{ return !sig(x-a.x)&&!sig(y-a.y);}
    double ABS() const { return sqrt(x * x + y * y); }
    double abs2() const { return x * x + y * y; }
    double arg() const { return atan2(y, x); }
    double dot(const Pt &a) const { return x * a.x + y * a.y; }
    double det(const Pt &a) const { return x * a.y - y * a.x; }
};
double tri(const Pt &a, const Pt &b, const Pt &c) { return (b - a).det(c - a); }
int iSP(Pt a, Pt b, Pt c) {
    int s = sig((b - a).det(c - a));
    if (s) return s;
    if (sig((b - a).dot(c - a)) < 0) return -2; // c-a-b
    if (sig((a - b).dot(c - b)) < 0) return +2; // a-b-c
    return 0;
}
double x[1100];
double y[1100];
Pt p[1100];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%lf%lf",x+i,y+i);
	for(int i=0;i<a;i++)p[i]=Pt(x[i],y[i]);
	double tx,ty,tv;
	double px,py,pv;
	scanf("%lf%lf%lf%lf%lf%lf",&tx,&ty,&tv,&px,&py,&pv);
	Pt st=Pt(tx,ty);
	Pt sp=Pt(px,py);
	int at=0;
	double ret=0;
	for(int i=0;i<a-1;i++){
		if((iSP(p[i],p[i+1],st)+2)%2==0){
			at=i;break;
		}
	}
	double left=0;
	double right=0;
	for(int i=0;i<=at;i++){
		if(i==at)right+=(st-p[i]).ABS();
		else right+=(p[i+1]-p[i]).ABS();
	}
	right/=tv;
	ret=max(ret,right);
	Pt f;
	double ft;
	bool fcan=false;
	bool gcan=false;
	for(int i=0;i<50;i++){
		double M=(left+right)/2;
		double m=M*tv;
		f=p[0];
		for(int j=at;j>=0;j--){
			double d=0;
			Pt start=p[j+1];
			if(j==at){
				if((st-p[j]).ABS()<EPS)continue;
				d=(st-p[j]).ABS();
				start=st;
			}else d=(p[j+1]-p[j]).ABS();
			if(m<d){
				f=start+(p[j]-start)*(m/d);
				break;
			}else m-=d;
		}
		double d2=(sp-f).ABS()/pv;
		if(d2>M){
			left=M;
		}else{
			right=M;
			fcan=true;
		}
	}
	ft=right;
	
	left=right=0;
	for(int i=at;i<a-1;i++){
		if(i==at)right+=(st-p[i+1]).ABS();
		else right+=(p[i+1]-p[i]).ABS();
	}
	right/=tv;
	ret=max(ret,right);
	Pt g;
	double gt;
	for(int i=0;i<50;i++){
		double M=(left+right)/2;
		double m=M*tv;
		g=p[a-1];
		for(int j=at;j<a-1;j++){
			double d=0;
			Pt start=p[j];
			if(j==at){
				if((st-p[j+1]).ABS()<EPS)continue;
				d=(st-p[j+1]).ABS();
				start=st;
			}else d=(p[j+1]-p[j]).ABS();
			if(m<d){
				g=start+(p[j+1]-start)*(m/d);
				break;
			}else m-=d;
		}
		double d2=(sp-g).ABS()/pv;
		if(d2>M){
			left=M;
		}else{
			right=M;
			gcan=true;
		}
	}
	gt=right;
	left=0;
	right=0;
	sp=f;
	for(int i=at;i<a-1;i++){
		if(i==at)right+=(st-p[i+1]).ABS();
		else right+=(p[i+1]-p[i]).ABS();
	}
	bool hcan=false;
	right/=tv;
	//right=ret;
	right=max(right,ft);
	Pt tmp;
	for(int i=0;i<50;i++){
		double M=(left+right)/2;
		double m=M*tv;
		tmp=p[a-1];
		for(int j=at;j<a-1;j++){
			double d=0;
			Pt start=p[j];
			if(j==at){
				if((st-p[j+1]).ABS()<EPS)continue;
				d=(st-p[j+1]).ABS();
				start=st;
			}else d=(p[j+1]-p[j]).ABS();
			if(m<d){
				tmp=start+(p[j+1]-start)*(m/d);
				break;
			}else m-=d;
		}
		double d2=(sp-tmp).ABS()/pv;
		if(d2+ft>M)left=M;
		else {right=M;hcan=true;}
	}
	if(fcan)ret=min(ret,right);
	
	left=0;
	right=0;
	sp=g;
	for(int i=0;i<=at;i++){
		if(i==at)right+=(st-p[i]).ABS();
		else right+=(p[i+1]-p[i]).ABS();
	}
	hcan=false;
	right/=tv;
	right=max(right,gt);
	//right=ret;
	for(int i=0;i<50;i++){
		double M=(left+right)/2;
		double m=M*tv;
		tmp=p[0];
		for(int j=at;j>=0;j--){
			double d=0;
			Pt start=p[j+1];
			if(j==at){
				if((st-p[j]).ABS()<EPS)continue;
				d=(st-p[j]).ABS();
				start=st;
			}else d=(p[j+1]-p[j]).ABS();
			if(m<d){
				tmp=start+(p[j]-start)*(m/d);
				break;
			}else m-=d;
		}
		double d2=(sp-tmp).ABS()/pv;
		if(d2+gt>M)left=M;
		else {right=M;hcan=true;}
	}
	if(gcan)ret=min(ret,right);
//	printf("%f %f %f\n",f.x,f.y,ft);
//	printf("%f %f %f\n",g.x,g.y,gt);
	
	printf("%.9f\n",ret);
}