#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void maximize(T& a, const T& b) {
  if (b > a) a = b;
}
const int N = 210;
int n, x[N], y[N], q, m;
vector<int> line[N * N];
vector<int> mylines[N];
int goline[N][N];
double sums[N];
bool online(int i, int j, int k) {
  return (x[j] - x[i]) * (y[k] - y[i]) - (y[j] - y[i]) * (x[k] - x[i]) == 0;
}
struct vec_t {
  double v[N];
};
struct mat_t {
  double v[N][N];
};
vec_t vecmatmul(const vec_t& v, const mat_t& A) {
  vec_t u;
  for (int i = 0; i < (n); ++i) u.v[i] = 0;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (n); ++j) u.v[i] += v.v[j] * A.v[j][i];
  return u;
}
mat_t matmul(const mat_t& A, const mat_t& B) {
  mat_t C;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (n); ++j) C.v[i][j] = 0;
  for (int i = 0; i < (n); ++i)
    for (int k = 0; k < (n); ++k)
      for (int j = 0; j < (n); ++j) C.v[i][j] += A.v[i][k] * B.v[k][j];
  return C;
}
mat_t matpow(mat_t A, int k) {
  mat_t W;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (n); ++j) W.v[i][j] = i == j;
  while (k) {
    if (k & 1) W = matmul(W, A);
    A = matmul(A, A);
    k /= 2;
  }
  return W;
}
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)
    for (int j = 0; j < (n); ++j) goline[i][j] = -1;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (i); ++j)
      if (goline[i][j] == -1) {
        for (int k = 0; k < (n); ++k)
          if (online(i, j, k)) {
            line[m].push_back(k);
          }
        for (__typeof((line[m]).begin()) _i = (line[m]).begin();
             _i != (line[m]).end(); ++_i)
          for (__typeof((line[m]).begin()) _j = (line[m]).begin();
               _j != (line[m]).end(); ++_j)
            if (*_i != *_j) {
              goline[*_i][*_j] = m;
            }
        for (__typeof((line[m]).begin()) _i = (line[m]).begin();
             _i != (line[m]).end(); ++_i)
          mylines[*_i].push_back(m);
        m++;
      }
  mat_t Mat;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (n); ++j)
      if (goline[i][j] != -1) {
        Mat.v[i][j] = 1. / mylines[j].size() / line[goline[i][j]].size();
      }
  for (int i = 0; i < (n); ++i)
    for (__typeof((mylines[i]).begin()) j = (mylines[i]).begin();
         j != (mylines[i]).end(); ++j) {
      Mat.v[i][i] += 1. / mylines[i].size() / line[*j].size();
    }
  const int MAXM_LOG = 14;
  mat_t pows_Mat[MAXM_LOG];
  pows_Mat[0] = Mat;
  for (int i = 0; i < (MAXM_LOG - 1); ++i) {
    pows_Mat[i + 1] = matmul(pows_Mat[i], pows_Mat[i]);
  }
  scanf("%d", &q);
  for (int i = 0; i < (q); ++i) {
    int ti, mi;
    scanf("%d%d", &ti, &mi);
    --ti;
    --mi;
    vec_t v;
    for (int i = 0; i < (n); ++i) v.v[i] = i == ti;
    int pw = 0;
    while (mi) {
      if (mi & 1) v = vecmatmul(v, pows_Mat[pw]);
      mi /= 2;
      pw++;
    }
    double ans = 0;
    for (int j = 0; j < (m); ++j) {
      double pr = 0;
      for (__typeof((line[j]).begin()) k = (line[j]).begin();
           k != (line[j]).end(); ++k)
        pr += v.v[*k];
      ans = max(ans, pr / line[j].size());
    }
    printf("%.9lf\n", ans);
  }
}
