#include <bits/stdc++.h>
using namespace std;
const int N = 200, LogM = 14, M = 1 << LogM;
int n, q, x[N], y[N], belong[N];
vector<vector<int>> line;
double A[LogM][N][N], f[N], g[N];
bool collinear(int i, int j, int k) {
  return (x[j] - x[i]) * (y[k] - y[i]) == (y[j] - y[i]) * (x[k] - x[i]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(20);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      bool new_line = true;
      for (int k = 0; k < j; k++) {
        new_line &= i == k || !collinear(i, j, k);
      }
      if (!new_line) continue;
      vector<int> l = {i, j};
      for (int k = j + 1; k < n; k++) {
        if (collinear(i, j, k)) {
          l.push_back(k);
        }
      }
      line.push_back(l);
    }
  }
  for (auto &l : line) {
    for (int i : l) {
      belong[i]++;
    }
  }
  for (auto &l : line) {
    for (int i : l) {
      for (int j : l) {
        A[0][j][i] += 1.0 / belong[i] / l.size();
      }
    }
  }
  for (int k = 1; k < LogM; k++) {
    for (int r = 0; r < n; r++) {
      for (int c = 0; c < n; c++) {
        for (int i = 0; i < n; i++) {
          A[k][r][c] += A[k - 1][r][i] * A[k - 1][i][c];
        }
      }
    }
  }
  cin >> q;
  while (q--) {
    int t, m;
    cin >> t >> m;
    t--;
    m--;
    for (int c = 0; c < n; c++) {
      f[c] = c == t;
    }
    for (int k = 0; k < LogM; k++) {
      if (m >> k & 1) {
        for (int c = 0; c < n; c++) {
          g[c] = 0;
          for (int i = 0; i < n; i++) {
            g[c] += f[i] * A[k][i][c];
          }
        }
        for (int c = 0; c < n; c++) {
          f[c] = g[c];
        }
      }
    }
    double ans = 0.0;
    for (auto &l : line) {
      double opt = 0.0;
      for (int i : l) {
        opt += f[i];
      }
      ans = max(ans, opt / l.size());
    }
    cout << ans << '\n';
  }
}
