#include <bits/stdc++.h>
using namespace std;
int n, q, t, m, tot;
double trans[15][205][205], go1[205], go2[205];
bool vis[205];
struct node {
  double x, y;
} p[205];
struct node2 {
  double a, b, c;
  int pass[205], cnt;
} line[40050];
double Abs(double x) { return x > 0 ? x : -x; }
void calcline(double &a, double &b, double &c, node x, node y) {
  node fa;
  fa.x = x.x - y.x, fa.y = x.y - y.y;
  a = fa.y, b = -fa.x;
  c = -a * x.x - b * x.y;
}
inline bool On(double a, double b, double c, node x) {
  return Abs(a * x.x + b * x.y + c) < 1e-6;
}
void bz() {
  for (int w = 1; w <= 14; w++)
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        for (int k = 1; k <= n; k++)
          trans[w][i][j] += trans[w - 1][i][k] * trans[w - 1][k][j];
}
void print() {
  for (int k = 0; k <= 2; k++) {
    printf("%d\n", k);
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        printf("%lf ", trans[k][i][j]);
      }
      printf("\n");
    }
  }
}
int main() {
  double A, B, C;
  node2 L;
  int cnt;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lf%lf", &p[i].x, &p[i].y);
  for (int i = 1; i <= n; i++) {
    memset(vis, 0, sizeof(vis));
    vis[i] = 1;
    int st = tot;
    for (int j = 1; j <= n; j++) {
      if (!vis[j]) {
        vis[j] = 1, cnt = 2;
        L.a = L.b = L.c = L.cnt = 0;
        L.pass[++L.cnt] = i, L.pass[++L.cnt] = j;
        calcline(L.a, L.b, L.c, p[i], p[j]);
        for (int k = 1; k <= n; k++)
          if (!vis[k] && On(L.a, L.b, L.c, p[k]))
            L.pass[++L.cnt] = k, vis[k] = 1;
        line[++tot] = L;
      }
    }
    int T = tot - st;
    for (int j = st + 1; j <= tot; j++) {
      for (int k = 1; k <= line[j].cnt; k++) {
        trans[0][i][line[j].pass[k]] += (1.0 / T) / line[j].cnt;
      }
    }
  }
  bz();
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d", &t, &m);
    m--;
    for (int i = 1; i <= n; i++) go1[i] = 0;
    go1[t] = 1;
    for (int i = 14; ~i; i--) {
      if ((m >> i) & 1) {
        memset(go2, 0, sizeof(go2));
        for (int j = 1; j <= n; j++) {
          for (int k = 1; k <= n; k++) {
            go2[j] += trans[i][j][k] * go1[k];
          }
        }
        for (int j = 1; j <= n; j++) go1[j] = go2[j];
      }
    }
    double cur, ans = 0;
    for (int i = 1; i <= tot; i++) {
      cur = 0;
      for (int j = 1; j <= line[i].cnt; j++) {
        cur += go1[line[i].pass[j]] / line[i].cnt;
      }
      ans = max(ans, cur);
    }
    printf("%lf\n", ans);
  }
  return 0;
}
