#include <bits/stdc++.h>
using namespace std;
const int p = 1e9 + 7;
const double eps = 1e-9;
int N, m, Ans;
double x[1005], y[1005];
inline bool eq(double a, double b) { return fabs(a - b) < eps; }
struct Vec {
  double x, y, k;
  Vec(double x = 0, double y = 0, double k = 0) : x(x), y(y), k(k) {}
  bool operator<(const Vec& A) const {
    return eq(x, A.x) ? eq(y, A.y) ? k < A.k : y < A.y : x < A.x;
  }
} a[1000006];
int main() {
  scanf("%d", &N);
  for (int _r = N, i = 0; i < _r; ++i) {
    int a, b, c, d;
    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] = c * b * b * d * 1. / (a * a * d * d + b * b * c * c);
  }
  for (int _r = N, i = 0; i < _r; ++i)
    for (int _r = i, j = 0; j < _r; ++j)
      a[m++] = Vec(x[i] + x[j], y[i] + y[j],
                   eq(x[i], x[j]) ? 1e50 : (y[j] - y[i]) / (x[j] - x[i]));
  sort(a, a + m);
  for (int l = 0, r; l < m; l = r) {
    for (r = l; r < m && eq(a[l].x, a[r].x) && eq(a[l].y, a[r].y); ++r)
      ;
    long long res = 1, c = 1;
    for (int _r = r, i = l; i < _r; ++i)
      if (eq(a[i].k, a[i + 1].k) && i + 1 < r)
        ++c;
      else
        res = res * (c + 1) % p, c = 1;
    Ans = (Ans + res - r + l - 1) % p;
  }
  printf("%d\n", (Ans + p) % p);
}
