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;
  Point operator*(double cof) {
    Point ret;
    ret.x = x * cof;
    ret.y = y * cof;
    return ret;
  }
  Point operator+(Point other) {
    Point ret;
    ret.x = x + other.x;
    ret.y = y + other.y;
    return ret;
  }
  Point operator-(Point other) {
    Point ret;
    ret.x = x - other.x;
    ret.y = y - other.y;
    return ret;
  }
};
struct Ray {
  Point start, speed;
};
struct Segment {
  Point start, ending;
};
struct Line {
  Point start, dir0, dir1;
};
struct Triangle {
  Point a, b, c;
};
const double error = 1e-9;
const int MAXN = 10000;
Point polygon[MAXN];
Point A, V, U;
double Vz, Fdown, Uz;
Ray r0, r1;
Line line0;
double r0_t, r1_t, line0_t;
int n;
bool Equals(double val0, double val1) {
  double tem = fabs(val0 - val1);
  return tem < error;
}
double CrossProduct(Point a, Point b) { return (a.x * b.y - a.y * b.x); }
double dist(Point a, Point b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
bool InSegment(Point test, Point a, Point b) {
  double tem = CrossProduct(a - test, b - test);
  if (a.x > b.x) swap(a.x, b.x);
  if (a.y > b.y) swap(a.y, b.y);
  return Equals(tem, 0) && (a.x - error <= test.x && test.x <= b.x + error &&
                            a.y - error <= test.y && test.y <= b.y + error);
}
double CheckRayCrossSegment(Ray ray, Segment seg) {
  double tem = (seg.start.x - seg.ending.x) * ray.speed.y -
               (seg.start.y - seg.ending.y) * ray.speed.x;
  if (Equals(tem, 0))
    return -1;
  else {
    double t = (seg.start.y - seg.ending.y) * ray.start.x +
               (seg.start.x * seg.ending.y - seg.ending.x * seg.start.y) -
               (seg.start.x - seg.ending.x) * ray.start.y;
    t /= tem;
    if (t < 0) return -1;
    Point p = (ray.start + (ray.speed * t));
    if (InSegment(p, seg.start, seg.ending))
      return t;
    else
      return -1;
  }
}
double CheckRayCrossPolygon(Ray ray) {
  double minv = DBL_MAX;
  for (int i = 0; i < n; i++) {
    Segment s;
    s.start = polygon[i];
    s.ending = polygon[(i + 1) % n];
    double val = CheckRayCrossSegment(ray, s);
    if (val > 0) minv = min(minv, val);
  }
  return minv;
}
bool IsTriangle(Triangle tr) {
  return !Equals(CrossProduct(tr.a - tr.b, tr.a - tr.c), 0);
}
bool InTriangle(Point p, Triangle tr) {
  if (!IsTriangle(tr)) return false;
  double cro0 = CrossProduct(tr.a - p, tr.b - p);
  double cro1 = CrossProduct(tr.b - p, tr.c - p);
  double cro2 = CrossProduct(tr.c - p, tr.a - p);
  if (InSegment(p, tr.a, tr.b) || InSegment(p, tr.b, tr.c) ||
      InSegment(p, tr.c, tr.a))
    return true;
  if (cro0 * cro1 < 0 || cro1 * cro2 < 0 || cro2 * cro0 < 0) return false;
  return true;
}
double CheckLineCrossPoint(Line line, Point p) {
  double ansmin = 0, ansmax = 1e100;
  Point tem0, tem1;
  Triangle tr;
  tr.a = line.start + (line.dir0 * ansmax);
  tr.b = line.start + (line.dir1 * ansmax);
  tr.c = line.start;
  if (!InTriangle(p, tr)) return -1;
  while (!Equals(ansmin, ansmax)) {
    double ansmid = (ansmin + ansmax) / 2;
    tr.a = line.start + (line.dir0 * ansmid);
    tr.b = line.start + (line.dir1 * ansmid);
    tr.c = line.start;
    if (InTriangle(p, tr))
      ansmax = ansmid;
    else
      ansmin = ansmid;
  }
  return ansmax;
}
double CheckLineCrossPolygonPoint(Line line, double &line_t_tem) {
  double minv = DBL_MAX;
  for (int i = 0; i < n; i++) {
    Point s;
    s = polygon[i];
    double deltab = CheckLineCrossPoint(line, s);
    if (deltab > 0) {
      if (deltab < minv) {
        minv = deltab;
        if (!Equals(U.x, 0))
          line_t_tem =
              (deltab * Vz -
               (fabs(line.start.x + line.dir0.x * deltab - s.x) / fabs(U.x)) *
                   -Uz) /
              -Fdown;
        else
          line_t_tem =
              (deltab * Vz -
               (fabs(line.start.y + line.dir0.y * deltab - s.y) / fabs(U.y)) *
                   -Uz) /
              -Fdown;
      }
    }
  }
  return minv;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lf%lf", &(polygon[i].x), &(polygon[i].y));
  scanf("%lf%lf", &(A.x), &(A.y));
  scanf("%lf%lf%lf", &(V.x), &(V.y), &(Vz));
  scanf("%lf", &(Fdown));
  scanf("%lf%lf%lf", &(U.x), &(U.y), &(Uz));
  r0.start = A;
  r0.speed = V;
  r1.start = A;
  r1.speed = (V + (U * (Vz / -Uz)));
  line0.start = A;
  line0.dir0 = r0.speed;
  line0.dir1 = r1.speed;
  double line_t_tem;
  r0_t = CheckRayCrossPolygon(r0);
  r1_t = CheckRayCrossPolygon(r1);
  line0_t = CheckLineCrossPolygonPoint(line0, line_t_tem);
  double minval = min(min(r0_t, r1_t), line0_t);
  if (Equals(minval, DBL_MAX))
    printf("%.9lf %.9lf\n", (double)-1, (double)-1);
  else if (Equals(r1_t, minval))
    printf("%.9lf %.9lf\n", r1_t, 0);
  else if (Equals(r0_t, minval))
    printf("%.9lf %.9lf\n", r0_t, r0_t * Vz / -Fdown);
  else if (Equals(line0_t, minval)) {
    if (Equals(line0_t, r1_t))
      printf("%.9lf %.9lf\n", r1_t, 0);
    else
      printf("%.9lf %.9lf\n", line0_t, line_t_tem);
  }
  return 0;
}