#include <bits/stdc++.h>
using namespace std;
const int mo = 1000000007;
int i, n, tot, j, tmp, o, ans;
struct ppp {
  double x, y;
} p[1200];
struct ex {
  double x, y, f;
} a[1200 * 1200 / 2];
bool equal(double x, double y) { return abs(x - y) < 1e-9; }
bool cmp(const ex &a, const ex &b) {
  if (equal(a.x, b.x)) {
    if (equal(a.y, b.y)) return a.f < b.f;
    return a.y < b.y;
  }
  return a.x < b.x;
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    double a, b, c, d, x, y;
    scanf("%lf%lf%lf%lf", &a, &b, &c, &d);
    x = a / b;
    y = c / d;
    p[i].x = x / (x * x + y * y);
    p[i].y = y / (x * x + y * y);
  }
  tot = 0;
  for (i = 1; i <= n; ++i)
    for (j = i + 1; j <= n; ++j) {
      a[++tot].x = p[i].x + p[j].x;
      a[tot].y = p[i].y + p[j].y;
      if (equal(p[j].x, p[i].x))
        a[tot].f = 1e9;
      else
        a[tot].f = (p[j].y - p[i].y) / (p[j].x - p[i].x);
    }
  sort(a + 1, a + tot + 1, cmp);
  for (i = 1; i <= tot; i = j) {
    tmp = 1;
    o = 1;
    for (j = i + 1; j <= tot && equal(a[j].x, a[i].x) && equal(a[j].y, a[i].y);
         ++j) {
      if (equal(a[j].f, a[j - 1].f))
        tmp++;
      else
        o = 1ll * o * (tmp + 1) % mo, tmp = 1;
    }
    o = 1ll * o * (tmp + 1) % mo;
    ans = (ans + o - 1) % mo;
  }
  printf("%d\n", ans - tot);
}
