#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 200;
const int MAXLG = 16;
typedef double Mat[MAXN][MAXN];
typedef double Vec[MAXN];
struct P {
  int x, y;
};
int n;
P p[MAXN];
Mat pone;
Mat pmany[MAXLG + 1];
Vec pok;
void mmlt(const Mat &A, const Mat &B, Mat &C) {
  Mat tmp;
  for (int i = (0); i < (n); ++i)
    for (int j = (0); j < (n); ++j) {
      double cur = 0;
      for (int k = (0); k < (n); ++k) cur += A[i][k] * B[k][j];
      tmp[i][j] = cur;
    }
  for (int i = (0); i < (n); ++i)
    for (int j = (0); j < (n); ++j) C[i][j] = tmp[i][j];
}
void vmlt(const Mat &A, const Vec &b, Vec &c) {
  Vec tmp;
  for (int i = (0); i < (n); ++i) {
    double cur = 0;
    for (int j = (0); j < (n); ++j) cur += A[i][j] * b[j];
    tmp[i] = cur;
  }
  for (int i = (0); i < (n); ++i) c[i] = tmp[i];
}
void run() {
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) scanf("%d%d", &p[i].x, &p[i].y);
  for (int i = (0); i < (n); ++i)
    for (int j = (0); j < (n); ++j) pone[i][j] = 0;
  for (int i = (0); i < (n); ++i) {
    map<pair<int, int>, vector<int> > cur;
    for (int j = (0); j < (n); ++j)
      if (j != i) {
        int dx = p[j].x - p[i].x, dy = p[j].y - p[i].y;
        if (dy < 0 || dy == 0 && dx < 0) dy = -dy, dx = -dx;
        int g = gcd(abs(dx), dy);
        dx /= g, dy /= g;
        cur[make_pair(dx, dy)].push_back(j);
      }
    for (auto it = cur.begin(); it != cur.end(); ++it) {
      vector<int> now = it->second;
      double peach = 1.0 / ((int)(cur).size()) / (((int)(now).size()) + 1);
      pone[i][i] += peach;
      for (int j = (0); j < (((int)(now).size())); ++j)
        pone[i][now[j]] += peach;
    }
  }
  for (int i = (0); i < (n); ++i)
    for (int j = (0); j < (n); ++j) pmany[0][i][j] = pone[i][j];
  for (int k = (0); k < (MAXLG); ++k) mmlt(pmany[k], pmany[k], pmany[k + 1]);
  set<vector<int> > opt;
  for (int i = (0); i < (n); ++i) {
    map<pair<int, int>, vector<int> > cur;
    for (int j = (0); j < (n); ++j)
      if (j != i) {
        int dx = p[j].x - p[i].x, dy = p[j].y - p[i].y;
        if (dy < 0 || dy == 0 && dx < 0) dy = -dy, dx = -dx;
        int g = gcd(abs(dx), dy);
        dx /= g, dy /= g;
        cur[make_pair(dx, dy)].push_back(j);
      }
    for (auto it = cur.begin(); it != cur.end(); ++it) {
      vector<int> now = it->second;
      now.push_back(i);
      sort(now.begin(), now.end());
      opt.insert(now);
    }
  }
  int nq;
  scanf("%d", &nq);
  for (int qi = (0); qi < (nq); ++qi) {
    int dst, steps;
    scanf("%d%d", &dst, &steps);
    --dst, --steps;
    for (int i = (0); i < (n); ++i) pok[i] = i == dst ? 1.0 : 0.0;
    for (int k = (0); k <= (MAXLG); ++k)
      if (steps & (1 << k)) vmlt(pmany[k], pok, pok);
    double ans = 0;
    for (auto it = opt.begin(); it != opt.end(); ++it) {
      vector<int> now = *it;
      double sum = 0;
      for (int j = (0); j < (((int)(now).size())); ++j) sum += pok[now[j]];
      ans = max(ans, sum / ((int)(now).size()));
    }
    printf("%.15lf\n", ans);
  }
}
int main() {
  run();
  return 0;
}
