#include <bits/stdc++.h>
using namespace std;
int i, j, n, size, idx;
double p[1010][2], a, b, c, d, x1, x2, x3, x4;
long long base, tot, tmp, cnt;
struct PAIR {
  double x, y, k;
} mypair[1010 * 505];
bool cmp(struct PAIR a, struct PAIR b) {
  if (fabs(a.x - b.x) < 1e-8) {
    if (fabs(a.y - b.y) < 1e-8) {
      return a.k < b.k;
    }
    return a.y < b.y;
  }
  return a.x < b.x;
}
int main() {
  scanf("%d\n", &n);
  for (i = 0; i < n; i++) {
    scanf("%lf %lf %lf %lf\n", &a, &b, &c, &d);
    p[i][0] = a / b;
    p[i][1] = c / d;
    p[i][0] /= (a * a / b / b + c * c / d / d);
    p[i][1] /= (a * a / b / b + c * c / d / d);
  }
  size = n * (n - 1) / 2;
  idx = 0;
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      x1 = p[i][0], x2 = p[j][0], x3 = p[i][1], x4 = p[j][1];
      mypair[idx].x = x1 + x2;
      mypair[idx].y = x3 + x4;
      mypair[idx].k = fabs(x1 - x2) < 1e-8 ? 1e9 : (x3 - x4) / (x1 - x2);
      idx++;
    }
  }
  sort(mypair, mypair + size, cmp);
  cnt = 0;
  base = 1000000007;
  for (i = 0; i < size; i = j) {
    tot = 1;
    tmp = 1;
    for (j = i + 1; j < size && fabs(mypair[j].x - mypair[i].x) < 1e-8 &&
                    fabs(mypair[j].y - mypair[i].y) < 1e-8;
         j++) {
      if (fabs(mypair[j].k - mypair[j - 1].k) < 1e-8) {
        tot++;
      } else {
        tmp = (tmp * (tot + 1)) % base;
        tot = 1;
      }
    }
    tmp = (tmp * (tot + 1)) % base;
    cnt = (cnt + tmp - 1) % base;
  }
  cout << cnt - size << endl;
  return 0;
}
