#include <bits/stdc++.h>
using namespace std;
const int N = 205, INF = 1e9;
struct Pt {
  int x, y;
  int operator^(Pt a) const { return x * a.y - y * a.x; }
} p[N];
int n, q;
map<pair<pair<int, int>, pair<int, int> >, set<int> > mp;
set<set<int> *> bl[N];
struct Matrix {
  double a[N][N];
  Matrix(int y = 0) {
    memset(a, 0, sizeof(a));
    for (int i = 1; i <= n; i++) a[i][i] = y;
  }
  Matrix(const Matrix &y) { memcpy(a, y.a, sizeof(a)); }
  Matrix operator*(const Matrix &y) const {
    Matrix z;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        for (int k = 1; k <= n; k++) z.a[i][j] += a[i][k] * y.a[k][j];
    return z;
  }
  Matrix operator^(int y) const {
    Matrix x = *this, ret = 1;
    while (y) {
      if (y & 1) ret = ret * x;
      x = x * x, y >>= 1;
    }
    return ret;
  }
} mtx[14];
void multi(double *x, Matrix &y) {
  static double a[N];
  memset(a, 0, sizeof(a));
  for (int j = 1; j <= n; j++)
    for (int k = 1; k <= n; k++) a[j] += x[k] * y.a[k][j];
  memcpy(x, a, sizeof(a));
}
double a[N];
int gcd(int x, int y) { return !y ? x : gcd(y, x % y); }
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> p[i].x >> p[i].y;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j < i; j++) {
      int yk, xk, yb, xb, gk, gb;
      yk = p[i].y - p[j].y, xk = p[i].x - p[j].x;
      if (!xk)
        yk = INF, xk = 1, yb = p[i].x, xb = 1;
      else
        yb = p[i].y * xk - yk * p[i].x, xb = xk;
      gk = gcd(yk, xk), yk /= gk, xk /= gk;
      if (yb)
        gb = gcd(yb, xb), yb /= gb, xb /= gb;
      else
        xb = 1;
      if (xk < 0) xk = -xk, yk = -yk;
      if (xb < 0) xb = -xb, yb = -yb;
      pair<pair<int, int>, pair<int, int> > pr =
          make_pair(make_pair(yk, xk), make_pair(yb, xb));
      set<int> *st = &mp[pr];
      st->insert(i);
      st->insert(j);
      bl[i].insert(st);
      bl[j].insert(st);
    }
  for (int i = 1; i <= n; i++) {
    double k = 1.0 / bl[i].size();
    for (set<int> *j : bl[i]) {
      double k2 = k / j->size();
      for (int l : *j) mtx[0].a[l][i] += k2;
    }
  }
  for (int i = 1; i <= 13; i++) mtx[i] = mtx[i - 1] * mtx[i - 1];
  cin >> q;
  while (q--) {
    int t, m;
    cin >> t >> m;
    m--;
    for (int i = 1; i <= n; i++) a[i] = i == t;
    for (int i = 13; ~i; i--)
      if (m >= 1 << i) m -= 1 << i, multi(a, mtx[i]);
    double ans = 0;
    for (map<pair<pair<int, int>, pair<int, int> >, set<int> >::iterator i =
             mp.begin();
         i != mp.end(); i++) {
      double sum = 0;
      for (int j : i->second) sum += a[j];
      ans = max(ans, sum / i->second.size());
    }
    cout << fixed << setprecision(10) << ans << endl;
  }
  return 0;
}
