Problem: How horrible! The empire of galactic chickens tries to conquer a beautiful city «Z», they have built a huge incubator that produces millions of chicken soldiers a day, and fenced it around. The huge incubator looks like a poligon on the the plane Oxy with n vertices. Naturally, DravDe can't keep still, he wants to destroy the chicken empire. For sure, he will start with the incubator.

DravDe is strictly outside the incubator's territory in point A(xa, ya), and wants to get inside and kill all the chickens working there. But it takes a lot of doing! The problem is that recently DravDe went roller skating and has broken both his legs. He will get to the incubator's territory in his jet airplane LEVAP-41.

LEVAP-41 flies at speed V(xv, yv, zv). DravDe can get on the plane in point A, fly for some time, and then air drop himself. DravDe is very heavy, that's why he falls vertically at speed Fdown, but in each point of his free fall DravDe can open his parachute, and from that moment he starts to fall at the wind speed U(xu, yu, zu) until he lands. Unfortunately, DravDe isn't good at mathematics. Would you help poor world's saviour find such an air dropping plan, that allows him to land on the incubator's territory? If the answer is not unique, DravDe wants to find the plan with the minimum time of his flight on the plane. If the answers are still multiple, he wants to find the one with the minimum time of his free fall before opening his parachute

Input

The first line contains number n (3 ≤ n ≤ 104) — amount of vertices of the fence. Then there follow n lines containing the coordinates of these vertices (two integer numbers xi, yi) in clockwise or counter-clockwise order. It's guaranteed, that the fence does not contain self-intersections.

The following four lines contain coordinates of point A(xa, ya), speeds V(xv, yv, zv), Fdown and speed U(xu, yu, zu). All the input numbers are integer. All the coordinates don't exceed 104 in absolute value. It's guaranteed, that zv > 0 and Fdown, zu < 0, and point A is strictly outside the incubator's territory.

Output

In the first line output two numbers t1, t2 such, that if DravDe air drops at time t1 (counting from the beginning of the flight), he lands on the incubator's territory (landing on the border is regarder as landing on the territory). If DravDe doesn't open his parachute, the second number should be equal to the duration of DravDe's falling down. If it's impossible for DravDe to get to the incubator's territory, output -1 -1. If the answer is not unique, output the answer with the minimum t1. If the answers are still multiple, output the answer with the minimum t2. Your answer must have an absolute or relative error less than 10 - 6.

Examples

Input

4
0 0
1 0
1 1
0 1
0 -1
1 0 1
-1
0 1 -1


Output

1.00000000 0.00000000


Input

4
0 0
0 1
1 1
1 0
0 -1
-1 -1 1
-1
0 1 -1


Output

-1.00000000 -1.00000000


Input

4
0 0
1 0
1 1
0 1
0 -1
1 1 1
-1
1 1 -1


Output

0.50000000 0.00000000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct point {
  double x, y, z;
};
point pt[11111], a, v, u;
int n;
double f, ans1, ans2, t1, t2;
const double inf = 1e9, eps = 1e-9;
int main() {
  int i, j, s, p, q;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%lf%lf", &pt[i].x, &pt[i].y);
  scanf("%lf%lf%lf%lf%lf", &a.x, &a.y, &v.x, &v.y, &v.z);
  scanf("%lf", &f);
  scanf("%lf%lf%lf", &u.x, &u.y, &u.z);
  double a1, b1, c1, a2, b2, c2, aa1, bb1, cc1, aa2, bb2, cc2;
  a1 = v.x + u.x * v.z / fabs(u.z);
  b1 = u.x * f / fabs(u.z);
  c1 = a.x;
  a2 = v.y + u.y * v.z / fabs(u.z);
  b2 = u.y * f / fabs(u.z);
  c2 = a.y;
  ans1 = ans2 = inf;
  for (i = 0; i < n; i++) {
    double x1, y1, x2, y2;
    x1 = pt[i].x;
    y1 = pt[i].y;
    x2 = pt[(i + 1) % n].x;
    y2 = pt[(i + 1) % n].y;
    aa1 = a2 * (x2 - x1) - a1 * (y2 - y1);
    bb1 = b2 * (x2 - x1) - b1 * (y2 - y1);
    cc1 = (c2 - y2) * (x2 - x1) - (c1 - x2) * (y2 - y1);
    if (fabs(bb1) > eps) {
      t1 = 0;
      t2 = -cc1 / bb1;
      if (a1 * t1 + b1 * t2 + c1 > min(x1, x2) - eps &&
          a1 * t1 + b1 * t2 + c1 < max(x1, x2) + eps) {
        if (t2 > -eps && a2 * t1 + b2 * t2 + c2 > min(y1, y2) - eps &&
            a2 * t1 + b2 * t2 + c2 < max(y1, y2) + eps &&
            v.z * t1 + f * t2 > -eps) {
          if (ans1 > t1 + eps) {
            ans1 = t1;
            ans2 = t2;
          } else if (fabs(ans1 - t1) < eps && ans2 > t2)
            ans2 = t2;
        }
      }
    }
    if (fabs(aa1) > eps) {
      t1 = -cc1 / aa1;
      t2 = 0;
      if (t1 > -eps) {
        if (a1 * t1 + b1 * t2 + c1 > min(x1, x2) - eps &&
            a1 * t1 + b1 * t2 + c1 < max(x1, x2) + eps) {
          if (a2 * t1 + b2 * t2 + c2 > min(y1, y2) - eps &&
              a2 * t1 + b2 * t2 + c2 < max(y1, y2) + eps &&
              v.z * t1 + f * t2 > -eps) {
            if (ans1 > t1 + eps) {
              ans1 = t1;
              ans2 = t2;
            } else if (fabs(ans1 - t1) < eps && ans2 > t2)
              ans2 = t2;
          }
        }
      }
    }
    double A, B;
    A = a1 * b2 - a2 * b1;
    B = (c1 - x1) * b2 - (c2 - y1) * b1;
    if (fabs(A) > eps) {
      t1 = -B / A;
      B = (c2 - y1) * a1 - (c1 - x1) * a2;
      t2 = -B / A;
      if (t1 > -eps && t2 > -eps) {
        if (a1 * t1 + b1 * t2 + c1 > min(x1, x2) - eps &&
            a1 * t1 + b1 * t2 + c1 < max(x1, x2) + eps) {
          if (a2 * t1 + b2 * t2 + c2 > min(y1, y2) - eps &&
              a2 * t1 + b2 * t2 + c2 < max(y1, y2) + eps &&
              v.z * t1 + f * t2 > -eps) {
            if (ans1 > t1 + eps) {
              ans1 = t1;
              ans2 = t2;
            } else if (fabs(ans1 - t1) < eps && ans2 > t2)
              ans2 = t2;
          }
        }
      }
      B = (c1 - x2) * b2 - (c2 - y2) * b1;
      t1 = -B / A;
      B = (c2 - y2) * a1 - (c1 - x2) * a2;
      t2 = -B / A;
      if (t1 > -eps && t2 > -eps) {
        if (a1 * t1 + b1 * t2 + c1 > min(x1, x2) - eps &&
            a1 * t1 + b1 * t2 + c1 < max(x1, x2) + eps) {
          if (a2 * t1 + b2 * t2 + c2 > min(y1, y2) - eps &&
              a2 * t1 + b2 * t2 + c2 < max(y1, y2) + eps &&
              v.z * t1 + f * t2 > -eps) {
            if (ans1 > t1 + eps) {
              ans1 = t1;
              ans2 = t2;
            } else if (fabs(ans1 - t1) < eps && ans2 > t2)
              ans2 = t2;
          }
        }
      }
    }
    A = (bb1 * v.z / f - aa1);
    B = cc1;
    if (fabs(A) > eps) {
      t1 = B / A;
      t2 = -v.z * t1 / f;
      if (t1 > -eps && t2 > -eps) {
        if (a1 * t1 + b1 * t2 + c1 > min(x1, x2) - eps &&
            a1 * t1 + b1 * t2 + c1 < max(x1, x2) + eps) {
          if (a2 * t1 + b2 * t2 + c2 > min(y1, y2) - eps &&
              a2 * t1 + b2 * t2 + c2 < max(y1, y2) + eps) {
            if (ans1 > t1 + eps) {
              ans1 = t1;
              ans2 = t2;
            } else if (fabs(ans1 - t1) < eps && ans2 > t2)
              ans2 = t2;
          }
        }
      }
    }
  }
  if (ans1 == inf) ans1 = ans2 = -1;
  printf("%.20f %.20f\n", ans1, ans2);
  return 0;
}