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<cstdio>
#include<complex>
#include<vector>
#include<cmath>
#include<utility>
#include<algorithm>

using namespace std;

const double eps=1e-9;

template<class T> bool eq(T a,T b){
	return abs(a-b)<eps;
}

template<class T> int sgn(T a){
	return eq(a,0.0)?0:(a>0?1:-1);
}


typedef complex<double> Point;
typedef complex<double> Vector;
typedef pair<Point,Point> Segment;
typedef vector<Point> Polyline;

Polyline poly;
Point pd,ph;
double vd,vh;
int N;

bool onSeg(Point a,Point b,Point c){
	//Is c on a-b?
	return eq(abs(a-b),abs(a-c)+abs(b-c));
}

double doP(Vector a,Vector b){
	return (conj(a)*b).real();
}

Point proj(Point a,Point b,Point c){
	if(eq(a,b)) return c;
	Point x=b-a,p=c-a;
	Point pr=x*(doP(x,p)/norm(x));
	return pr+a;
}

pair<double,Point> solve(Segment seg,Point pt,double human,double domino){
	Point p1=seg.first,p2=seg.second;
	double d1=abs(p1-pt),d2=abs(p2-pt);
	double ln=abs(p1-p2);
	double t1=d1/vh,t2=d2/vh;
	double td=ln/vd;
	if(human+t2>domino+td) return make_pair(-1,pt);
	Point lb=p1,ub=p2;
	for(int stage=0;stage<100;stage++){
		Point mid=(lb+ub)/2.0;
		double lDomino=abs(mid-p1);
		double lHuman=abs(mid-pt);
		double tDomino=domino+lDomino/vd;
		double tHuman=human+lHuman/vh;
		if(tHuman>tDomino) lb=mid;
		else ub=mid;
	}
	double retT=domino+abs(lb-p1)/vd;
	Point retP=lb;
	return make_pair(retT,retP);
}

double getLen(Polyline poly){
	double res=0;
	for(int i=0;i+1<poly.size();i++){
		res+=abs(poly[i+1]-poly[i]);
	}
	return res;
}

pair<double,Point> solve(Polyline poly,Point pt,double human){
	if(poly.size()<=1){
		return make_pair(0,pt);
	}
	double disSum=0;
	for(int i=0;i+1<poly.size();i++){
		Segment seg;
		seg.first=poly[i];
		seg.second=poly[i+1];
		Point perp=proj(poly[i],poly[i+1],pt);
		if(onSeg(poly[i],poly[i+1],perp)){
			Segment seg1,seg2;
			seg1=Segment(poly[i],perp);
			seg2=Segment(perp,poly[i+1]);
			pair<double,Point> res;
			res=solve(seg1,pt,human,disSum/vd);
			if(res.first>=0) return res;
			disSum+=abs(perp-poly[i]);
			res=solve(seg2,pt,human,disSum/vd);
			if(res.first>=0) return res;
			disSum+=abs(poly[i+1]-perp);
		}else{
			pair<double,Point> res;
			res=solve(seg,pt,human,disSum/vd);
			if(res.first>=0){
				return res;
			}
			disSum+=abs(poly[i+1]-poly[i]);
		}
	}
	return make_pair(0,pt);
}

double solve(Polyline left,Polyline right,Point pt){
	//go left->go right
	pair<double,Point> resL=solve(left,pt,0);
	pair<double,Point> resLR=solve(right,resL.second,resL.first);
	double cur;
	if(resL.first<eps){
		cur=getLen(left)/vd;
	}else{
		cur=resL.first;
	}
	
	if(resLR.first<eps){
		cur=max(cur,getLen(right)/vd);
	}else{
		cur=max(cur,resLR.first);
	}
	
	return cur;
}

int main(){
	int N;
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		poly.push_back(Point(x,y));
	}
	int x,y,v;
	scanf("%d%d%d",&x,&y,&v);
	pd=Point(x,y);
	vd=v;
	scanf("%d%d%d",&x,&y,&v);
	ph=Point(x,y);
	vh=v;
	if(eq(pd,ph)){
		printf("0\n");
		return 0;
	}
	if(eq(poly[0],pd)||eq(poly[N-1],pd)){
		if(eq(poly[N-1],pd)){
			reverse(poly.begin(),poly.end());
		}
		pair<double,Point> res=solve(poly,ph,0);
		double ans=res.first;
		if(ans<eps){
			double allDis=getLen(poly);
			ans=allDis/vd;
			printf("%.9f\n",ans);
			return 0;
		}
	}
	for(int i=0;i<N-1;i++){
		Point p1=poly[i];
		Point p2=poly[i+1];
		bool flg=onSeg(p1,p2,pd);
		if(flg){
			double ans=1e30;
			Polyline left,right;
			left.push_back(pd);
			for(int j=i;j>=0;j--) if(!eq(pd,poly[j])) left.push_back(poly[j]);
			right.push_back(pd);
			for(int j=i+1;j<N;j++) if(!eq(pd,poly[j])) right.push_back(poly[j]);
			ans=min(ans,solve(left,right,ph));
			ans=min(ans,solve(right,left,ph));
			printf("%.9f\n",ans);
			break;
		}
	}
	return 0;
}