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

using namespace std;

int xi,yi,vi;
int xp,yp,vp;

double check(vector<pair<int,int> > v,double &cx,double &cy,double t){
  double l=t,h=1e9;
  double lx,ly;
  for(int i=0;i<1000;i++){
    double m=(l+h)/2;
    double r=m;
    int idx;
    for(idx=0;idx<v.size()-1;idx++){
      double ct=hypot(v[idx+1].first-v[idx].first,v[idx+1].second-v[idx].second)/vi;
      if(r<ct)break;
      r-=ct;
    }
    if(idx==v.size()-1){
      lx=v.back().first;
      ly=v.back().second;
    }else{
      complex<double> d=complex<double>(v[idx+1].first-v[idx].first,v[idx+1].second-v[idx].second);
      auto p=d/abs(d)*r*double(vi);
      lx=v[idx].first+p.real();
      ly=v[idx].second+p.imag();
    }
    if(hypot(cx-lx,cy-ly)<=vp*(m-t)){
      h=m;
    }else{
      l=m;
    }
  }
  cy=ly;
  cx=lx;
  return h;
}

int main(){
  int N;
  cin>>N;
  int x[1234],y[1234];
  for(int i=0;i<N;i++){
    cin>>x[i]>>y[i];
  }
  cin>>xi>>yi>>vi;
  cin>>xp>>yp>>vp;
  vector<pair<int,int> > v[2];
  for(int i=0;i<N;i++){
    if(x[i]==xi&&y[i]==yi){
      for(int j=i;j<N;j++){
	v[0].emplace_back(x[j],y[j]);
      }
      for(int j=i;j>=0;j--){
	v[1].emplace_back(x[j],y[j]);
      }
      goto endinit;
    }
  }
  for(int i=0;i<N-1;i++){
    if(min(x[i],x[i+1])<=xi&&xi<=max(x[i],x[i+1])&&min(y[i],y[i+1])<=yi&&yi<=max(y[i],y[i+1])
       &&(y[i+1]-y[i])*(xi-x[i])==(yi-y[i])*(x[i+1]-x[i])){
      v[0].emplace_back(xi,yi);
      for(int j=i;j>=0;j--){
	v[0].emplace_back(x[j],y[j]);
      }
      v[1].emplace_back(xi,yi);
      for(int j=i+1;j<N;j++){
	v[1].emplace_back(x[j],y[j]);
      }
      goto endinit;
    }
  }
 endinit:
  double t[2][2];
  for(int i=0;i<2;i++){
    double cx=xp,cy=yp;
    double ct=0;
    for(int j=0;j<2;j++){
      t[i][j]=check(v[i^j],cx,cy,ct);
      ct=t[i][j];
    }
  }
  double leave[2]={};
  for(int i=0;i<2;i++){
    for(int j=0;j<v[i].size()-1;j++){
      leave[i]+=hypot(v[i][j+1].first-v[i][j].first,v[i][j+1].second-v[i][j].second)/vi;
    }
  }
  cout<<fixed<<min({max(leave[0],leave[1]),t[0][1],t[1][1],max(t[0][0],leave[1]),max(t[1][0],leave[0])});
}