#include <bits/stdc++.h>
const int Mod = 1000000000 + 7;
int N;
double X[1000 + 7];
double Y[1000 + 7];
int same(double& a, double& b) { return fabs(a - b) < 1e-12; }
int Tot;
struct Point {
  double x, y;
  int a, b;
  bool operator<(const Point& B) const {
    return x + 1e-12 < B.x || (fabs(x - B.x) < 1e-12 && y + 1e-12 < B.y);
  }
} A[500000 + 7];
void Init() { scanf("%d", &N); }
void Work() {
  for (int i = 1, a, b, c, d; i <= N; i++) {
    scanf("%d %d %d %d", &a, &b, &c, &d);
    X[i] = a * b * d * d * 1. / (a * a * d * d + b * b * c * c);
    Y[i] = b * b * c * d * 1. / (a * a * d * d + b * b * c * c);
  }
  for (int i = 1; i <= N; i++)
    for (int j = i + 1; j <= N; j++)
      A[++Tot] = (Point){(X[i] + X[j]), (Y[i] + Y[j]), i, j};
  std::sort(A + 1, A + Tot + 1);
  int Cnt = 1, cur = 1;
  long long Answer = 0;
  for (int i = 1, j; i <= Tot;) {
    std::vector<double> v;
    for (j = i; j <= Tot && same(A[j].x, A[i].x) && same(A[j].y, A[i].y); j++) {
      int x = A[j].a;
      int y = A[j].b;
      if (X[x] + 1e-12 < X[y] || fabs(X[x] - X[y]) < 1e-12 && Y[x] < Y[y])
        x ^= y, y ^= x, x ^= y;
      v.push_back(atan2(Y[y] - Y[x], X[y] - X[x]));
    }
    i = j;
    if (v.size() < 2) continue;
    std::sort(v.begin(), v.end());
    long long ans = 1;
    for (j = 0; j < v.size();) {
      int pj = j, num = 1;
      double x = v[j];
      for (; same(v[j], x) && j < v.size(); j++) num++;
      ans = ans * num % Mod;
    }
    Answer = (Answer + ans - v.size() - 1) % Mod;
  }
  Answer %= Mod;
  if (Answer < 0) Answer += Mod;
  printf("%d\n", Answer);
}
int main() {
  Init();
  Work();
  return 0;
}
