#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000;
const long long MOD = 1000000007;
struct node {
  double x, y, f;
} p[MAXN * MAXN];
int l, n;
double x, y, X[MAXN], Y[MAXN];
long long ans;
bool equal(double a, double b) { return abs(a - b) < 1e-8; }
bool cmp(node a, node b) {
  if (equal(a.x, b.x)) {
    if (equal(a.y, b.y))
      return a.f < b.f;
    else
      return a.y < b.y;
  } else
    return a.x < b.x;
}
int main() {
  scanf("%d", &n);
  int ai, bi, ci, di;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d%d", &ai, &bi, &ci, &di);
    x = ai * 1.0 / bi;
    y = ci * 1.0 / di;
    X[i] = x / (x * x + y * y);
    Y[i] = y / (x * x + y * y);
  }
  l = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      l++;
      p[l].x = (X[i] + X[j]);
      p[l].y = (Y[i] + Y[j]);
      if (equal(X[i], X[j]))
        p[l].f = 1e9;
      else
        p[l].f = (Y[i] - Y[j]) / (X[i] - X[j]);
    }
  sort(p + 1, p + l + 1, cmp);
  for (int i = 1, j; i <= l; i = j) {
    int tmp = 1, o = 1;
    for (j = i + 1; j <= l && equal(p[i].x, p[j].x) && equal(p[i].y, p[j].y);
         ++j) {
      if (equal(p[j - 1].f, p[j].f))
        tmp++;
      else
        o = 1ll * o * (tmp + 1) % MOD, tmp = 1;
    }
    o = 1ll * o * (tmp + 1) % MOD;
    ans = (ans + o - 1) % MOD;
  }
  ans = (ans - l + MOD) % MOD;
  cout << ans << endl;
  return 0;
}
