Problem: Arkady reached the n-th level in Township game, so Masha decided to bake a pie for him! Of course, the pie has a shape of convex n-gon, i.e. a polygon with n vertices.

Arkady decided to cut the pie in two equal in area parts by cutting it by a straight line, so that he can eat one of them and give the other to Masha. There is a difficulty because Arkady has already put a knife at some point of the pie, so he now has to cut the pie by a straight line passing trough this point.

Help Arkady: find a line that passes through the point Arkady has put a knife into and cuts the pie into two parts of equal area, or determine that it's impossible. Your program has to quickly answer many queries with the same pie, but different points in which Arkady puts a knife.

Input

The first line contains two integers n and q (3 ≤ n ≤ 104, 1 ≤ q ≤ 105) — the number of vertices in the pie and the number of queries.

n line follow describing the polygon vertices in clockwise order. The i-th of these line contains two integers xi and yi ( - 106 ≤ xi, yi ≤ 106) — the coordinates of the i-th vertex. It is guaranteed that the polygon is strictly convex, in particular, no three vertices line on the same line.

An empty line follows.

q lines follow describing the query points. The i-th of these lines contain two integers xi and yi ( - 106 ≤ xi, yi ≤ 106) — the coordinates of the point in which Arkady puts the knife in the i-th query. In is guaranteed that in each query the given point is strictly inside the polygon, in particular, is not on its edges.

Output

For each query print single integer — the polar angle of the line that is the answer for the corresponding query, in radians. The angle should be in the segment [0;π], the angles are measured from the direction of OX axis in counter-clockwise order. For example, the polar angle of the OY axis is <image>. If there is no answer in that query, print -1.

If there are several answers, print any of them. Your answer is considered correct if the difference between the areas of the parts divided by the total area of the polygon doesn't exceed 10 - 4 by absolute value. In other words, if a and b are the areas of the parts after the cut, then your answer is correct if and only of <image>.

Examples

Input

3 1
0 0
0 3
3 0

1 1


Output

2.67794504460098710000


Input

5 3
6 5
6 3
5 0
0 0
0 5

5 4
3 3
5 2


Output

0.60228734612690049000
1.27933953226473580000
2.85805511179015910000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int A = 10000;
const long double PI = acos((long double)-1);
const long double PI2 = 2 * PI;
int gacnt = 0;
struct pt {
  pt(){};
  pt(long double x, long double y) : x(x), y(y){};
  long double x, y;
};
inline bool cclockw(const pt& a, const pt& b) { return a.x * b.y > a.y * b.x; }
pt u, v;
long double getalpha(long long x, long long y) {
  if (x > 0) {
    long double res = atan((long double)y / x);
    if (res < 0) res += PI2;
    return res;
  } else if (x < 0)
    return PI + atan((long double)y / x);
  else if (y > 0)
    return PI / 2;
  else
    return 3 * PI / 2;
  long double s = sqrt((long double)(x * x + y * y));
  if (y > 0)
    return acos(x / s);
  else
    return PI + acos(-x / s);
}
std::vector<int> x, y;
int n, q;
long double getdarea(long double x1, long double y1, long double x2,
                     long double y2, long double x3, long double y3) {
  return abs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));
  ;
}
int gincnt = 0;
int ccheck = 0;
int totcheck = 0;
int ck0check = 0;
int getind(long long px, long long py, pt val) {
  gincnt++;
  int l = 0;
  int r = n;
  pt vl, vr;
  vl.x = x[0] - px;
  vl.y = y[0] - py;
  vr.x = x[0] - px;
  vr.y = y[0] - py;
  int ck = 1;
  if (cclockw(val, vr)) ck = 2;
  int did = 0;
  while (r - l > 1) {
    totcheck++;
    if (ck == 0) ck0check++;
    int m = (r + l) / 2;
    pt vm;
    vm.x = x[m] - px;
    vm.y = y[m] - py;
    if (ck == 0) {
      if (cclockw(vm, val)) {
        l = m;
        vl = vm;
      } else {
        r = m;
        vr = vm;
      }
    } else if (ck == 1) {
      if (cclockw(vl, vm) && cclockw(vm, val)) {
        l = m;
        vl = vm;
      } else {
        r = m;
        vr = vm;
      }
    } else if (ck == 2) {
      if (cclockw(val, vm) && cclockw(vm, vr)) {
        r = m;
        vr = vm;
      } else {
        l = m;
        vl = vm;
      }
    }
    if (did > 4 && ck > 0) {
      ccheck++;
      if (cclockw(vl, vr)) ck = 0;
    }
    did++;
  }
  return l;
}
int getind(long long px, long long py, long double alpha) {
  pt val;
  val.x = cos(alpha);
  val.y = sin(alpha);
  return getind(px, py, val);
}
struct line {
  long double a, b, c;
};
const long double EPS = 1e-12;
long double det(long double a, long double b, long double c, long double d) {
  return a * d - b * c;
}
bool intersect(line m, line n, pt& res) {
  long double zn = det(m.a, m.b, n.a, n.b);
  if (abs(zn) < EPS) return false;
  res.x = -det(m.c, m.b, n.c, n.b) / zn;
  res.y = -det(m.a, m.c, n.a, n.c) / zn;
  return true;
}
pt pint(long long px, long long py, pt vec, int i) {
  long double x0 = x[i];
  long double y0 = y[i];
  long double dx = x[(i + 1) % n] - x0;
  long double dy = y[(i + 1) % n] - y0;
  pt res;
  line li;
  li.a = dy;
  li.b = -dx;
  li.c = -dy * x0 + dx * y0;
  line luch;
  luch.a = vec.y;
  luch.b = -vec.x;
  luch.c = -luch.a * px - luch.b * py;
  intersect(li, luch, res);
  return res;
}
pt pint(long long px, long long py, long double alpha, int i) {
  pt vec;
  vec.x = cos(alpha);
  vec.y = sin(alpha);
  return pint(px, py, vec, i);
}
long double total;
long long area[A][A / 5];
long double getard(long long px, long long py, pt v) {
  int i1 = getind(px, py, v);
  pt vop(-v.x, -v.y);
  int i2 = getind(px, py, vop);
  pt li1 = pint(px, py, v, i1);
  pt li2 = pint(px, py, vop, i2);
  int cover = i2 - (i1 + 1) % n;
  if (cover < 0) cover += n;
  int cur = (i1 + 1) % n;
  long double up = 0;
  while (cover > 0) {
    int st = min(cover, A / 5 - 1);
    up += area[cur % n][st];
    up += getdarea(x[(i1 + 1) % n], y[(i1 + 1) % n], x[cur % n], y[cur % n],
                   x[(cur + st) % n], y[(cur + st) % n]);
    cur += st;
    cover -= st;
  }
  up = up + getdarea(li1.x, li1.y, x[i2], y[i2], li2.x, li2.y) +
       getdarea(li1.x, li1.y, x[i2], y[i2], x[(i1 + 1) % n], y[(i1 + 1) % n]);
  return 2 * up - total;
}
long double getard(long long px, long long py, pt v, int i1, int i2) {
  pt vop(-v.x, -v.y);
  pt li1 = pint(px, py, v, i1);
  pt li2 = pint(px, py, vop, i2);
  int cover = i2 - (i1 + 1) % n;
  if (cover < 0) cover += n;
  int cur = (i1 + 1) % n;
  long double up = 0;
  while (cover > 0) {
    int st = min(cover, A / 5 - 1);
    up += area[cur % n][st];
    up += getdarea(x[(i1 + 1) % n], y[(i1 + 1) % n], x[cur % n], y[cur % n],
                   x[(cur + st) % n], y[(cur + st) % n]);
    cur += st;
    cover -= st;
  }
  up = up + getdarea(li1.x, li1.y, x[i2], y[i2], li2.x, li2.y) +
       getdarea(li1.x, li1.y, x[i2], y[i2], x[(i1 + 1) % n], y[(i1 + 1) % n]);
  return 2 * up - total;
}
long double getard(long long px, long long py, long double alpha, int i1,
                   int i2) {
  pt vec(cos(alpha), sin(alpha));
  return getard(px, py, vec, i1, i2);
}
long double getard(long long px, long long py, long double alpha) {
  pt vec(cos(alpha), sin(alpha));
  return getard(px, py, vec);
}
pair<long double, int> getardv(long long px, long long py, int v) {
  pt val;
  val.x = px - x[v];
  val.y = py - y[v];
  int i2 = getind(px, py, val);
  pt li1(x[v], y[v]);
  pt li2 = pint(px, py, val, i2);
  int cover = i2 - v;
  if (cover < 0) cover += n;
  int cur = v;
  long double up = 0;
  while (cover > 0) {
    int st = min(cover, A / 5 - 1);
    up += area[cur % n][st];
    up += getdarea(x[v], y[v], x[cur % n], y[cur % n], x[(cur + st) % n],
                   y[(cur + st) % n]);
    cur += st;
    cover -= st;
  }
  up = up + getdarea(li1.x, li1.y, x[i2], y[i2], li2.x, li2.y);
  return make_pair(2 * up - total, i2);
}
long long getarea(long long x1, long long y1, long long x2, long long y2,
                  long long x3, long long y3) {
  return (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1);
}
long double solve(int qx, int qy) {
  int vl, vr;
  auto t0 = getardv(qx, qy, 0);
  int i2 = t0.second;
  pt vecl, vecr;
  vecl = pt(x[0] - qx, y[0] - qy);
  vecr = pt(qx - x[0], qy - y[0]);
  if (t0.first < 0) {
    vl = 0;
    vr = i2 + 1;
  } else {
    vl = i2;
    vr = n;
    swap(vecl, vecr);
  }
  while (vr - vl > 1) {
    int vm = (vr + vl) / 2;
    if (getardv(qx, qy, vm).first > 0) {
      vr = vm;
      vecr = pt(x[vm] - qx, y[vm] - qy);
    } else {
      vl = vm;
      vecl = pt(x[vm] - qx, y[vm] - qy);
    }
  }
  int ind1 = vl;
  pt avecl(-vecl.x, -vecl.y);
  pt avecr(-vecr.x, -vecr.y);
  int nl = getind(qx, qy, avecl);
  int nr = getind(qx, qy, avecr) + 1;
  if (nr <= nl) nr += n;
  while (nr - nl > 1) {
    int nm = (nr + nl) / 2;
    if (getardv(qx, qy, nm % n).first < 0) {
      nr = nm;
      avecr = pt(x[nm % n] - qx, y[nm % n] - qy);
    } else {
      nl = nm;
      avecl = pt(x[nm % n] - qx, y[nm % n] - qy);
    }
  }
  int ind2 = nl % n;
  long double al = getalpha(-avecl.x, -avecl.y);
  long double ar = getalpha(-avecr.x, -avecr.y);
  if (ar < al) ar += PI2;
  for (int it = 0; it < 50; it++) {
    long double am = (al + ar) / 2;
    if (getard(qx, qy, am, ind1, ind2) > 0)
      ar = am;
    else
      al = am;
  }
  while (al > PI) al -= PI;
  return al;
}
int main() {
  scanf("%d %d", &n, &q);
  x.resize(n);
  y.resize(n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &x[i], &y[i]);
  }
  reverse((x).begin(), (x).end());
  reverse((y).begin(), (y).end());
  for (int st = 2; st < A / 5; st++) {
    for (int i = 0; i < n; i++) {
      int i2 = (i + st - 1) % n;
      int i3 = (i + st) % n;
      area[i][st] = area[i][st - 1] +
                    abs(getarea(x[i], y[i], x[i2], y[i2], x[i3], y[i3]));
    }
  }
  total = 0;
  for (int st = 2; st < n; st++) {
    total += abs(getarea(x[0], y[0], x[st - 1], y[st - 1], x[st], y[st]));
  }
  for (int i = 0; i < q; i++) {
    int qxi, qyi;
    scanf("%d %d", &qxi, &qyi);
    long long qx = qxi;
    long long qy = qyi;
    long double al = solve(qx, qy);
    printf("%.15lf\n", (double)al);
  }
}