#include <bits/stdc++.h>
using namespace std;
const int N = 205;
int n;
struct Mat {
  double a[N][N];
  Mat() { memset(a, 0, sizeof(a)); }
  void init() {
    for (int i = 1; i <= n; i++) a[i][i] = 1;
  }
  Mat operator*(const Mat &b) const {
    Mat c;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        for (int k = 1; k <= n; k++) c.a[i][k] += a[i][j] * b.a[j][k];
    return c;
  }
} big[105], small[105];
struct P {
  int x, y;
  P operator-(const P &a) { return (P){x - a.x, y - a.y}; }
  int operator*(const P &a) { return x * a.y - y * a.x; }
} p[N];
bool vis[N][N];
vector<vector<int>> lines;
vector<int> be[N];
double val[N], tmp[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &p[i].x, &p[i].y);
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (!vis[i][j]) {
        vector<int> line;
        for (int k = 1; k <= n; k++)
          if ((p[k] - p[i]) * (p[k] - p[j]) == 0) line.push_back(k);
        for (auto &x : line) be[x].push_back((int)lines.size());
        for (auto &x : line)
          for (auto &y : line) vis[x][y] = 1;
        lines.push_back(line);
      }
  small[0].init();
  for (int i = 0; i <= n; i++)
    for (auto &t : be[i]) {
      double tmp = 1.0 / be[i].size() / lines[t].size();
      for (auto &j : lines[t]) small[1].a[i][j] += tmp;
    }
  for (int i = 2; i <= 100; i++) small[i] = small[i - 1] * small[1];
  big[0].init();
  big[1] = small[100];
  for (int i = 2; i <= 100; i++) big[i] = big[i - 1] * big[1];
  int Q;
  scanf("%d", &Q);
  while (Q--) {
    int t, m;
    scanf("%d%d", &t, &m);
    m--;
    memset(val, 0, sizeof(val));
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        val[i] += big[m / 100].a[i][j] * small[m % 100].a[j][t];
    double ans = 0;
    for (auto &line : lines) {
      double now = 0;
      for (auto &x : line) now += val[x];
      now /= line.size();
      ans = max(ans, now);
    }
    printf("%.15lf\n", ans);
  }
}
