#include <bits/stdc++.h>
using namespace std;
const int N = 201;
int n, x[N], y[N], q;
map<pair<int, int>, int> mp;
map<pair<int, int>, vector<int>> temp;
vector<vector<int>> lines;
struct matrix {
  double mat[N][N];
  matrix() { memset(mat, 0, sizeof mat); }
  void I() {
    for (int i = 0; i < N; i++) mat[i][i] = 1;
  }
  matrix operator*(const matrix a) const {
    matrix ret;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        for (int k = 0; k < n; k++) ret.mat[i][j] += mat[i][k] * a.mat[k][j];
    return ret;
  }
  vector<double> operator+(vector<double> a) {
    vector<double> ret(n, 0);
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) ret[i] += mat[i][j] * a[j];
    return ret;
  }
} lmao;
vector<matrix> lol;
int gcd(int a, int b) {
  if (!a) return b;
  if (!b) return a;
  return gcd(b, a % b);
}
pair<int, int> slope(int a, int b) {
  int x = ::x[a] - ::x[b], y = ::y[a] - ::y[b];
  int temp = gcd(x, y);
  if (temp)
    x /= temp, y /= temp;
  else
    x = x ? 1 : 0, y = y ? 1 : 0;
  return make_pair(x, y);
}
double find(int a, int b) {
  double ret = 0;
  if (a == b)
    for (auto i : mp) ret += 1.0 / i.second;
  else
    ret = 1.0 / mp[slope(a, b)];
  return ret;
}
void pre() {
  int to = 100;
  while (to) {
    lol.push_back(lmao);
    to >>= 1;
    lmao = lmao * lmao;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", x + i, y + i);
  for (int i = 0; i < n; i++) {
    mp.clear();
    temp.clear();
    for (int j = 0; j < n; j++)
      if (i != j) mp[slope(i, j)]++, temp[slope(i, j)].push_back(j);
    for (auto &j : temp) j.second.push_back(i), mp[j.first]++;
    for (int j = 0; j < n; j++) lmao.mat[i][j] = find(i, j) / mp.size();
    for (auto &j : temp)
      if (j.second.size() > 1)
        sort(j.second.begin(), j.second.end()), lines.push_back(j.second);
  }
  sort(lines.begin(), lines.end());
  lines.resize(unique(lines.begin(), lines.end()) - lines.begin());
  pre();
  scanf("%d", &q);
  for (int i = 0, a, m; i < q; i++) {
    scanf("%d%d", &a, &m);
    m = min(m, 100);
    m--;
    vector<double> temp(n, 0);
    temp[a - 1] = 1;
    for (int j = 0; j < 7; j++)
      if ((m >> j) & 1) temp = lol[j] + temp;
    double ans = 0;
    for (auto j : lines) {
      double mx = 0;
      for (auto k : j) mx += temp[k];
      mx /= j.size();
      ans = max(ans, mx);
    }
    printf("%.16f\n", ans);
  }
}
