#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int maxn = 1005;
const double eps = 1e-9;
int n;
pair<pair<double, double>, double> mid[maxn * maxn];
pair<double, double> p[maxn];
bool equal(pair<double, double> p1, pair<double, double> p2) {
  return fabs(p1.first - p2.first) < eps && fabs(p1.second - p2.second) < eps;
}
bool cmp(pair<pair<double, double>, double> p1,
         pair<pair<double, double>, double> p2) {
  if (fabs(p1.first.first - p2.first.first) > eps)
    return p1.first.first < p2.first.first;
  if (fabs(p1.first.second - p2.first.second) > eps)
    return p1.first.second < p2.first.second;
  return p1.second < p2.second;
}
double slope(double x, double y) {
  if (fabs(x) < eps) return 1e11;
  return y / x;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    double a, b, c, d, xx, yy;
    scanf("%lf%lf%lf%lf", &a, &b, &c, &d);
    xx = a / b, yy = c / d;
    p[i].first = xx / (xx * xx + yy * yy);
    p[i].second = yy / (xx * xx + yy * yy);
  }
  int tot = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; j++) {
      mid[++tot] = make_pair(
          make_pair(p[i].first + p[j].first, p[i].second + p[j].second),
          slope(p[i].first - p[j].first, p[i].second - p[j].second));
    }
  sort(mid + 1, mid + 1 + tot, cmp);
  long long ans = 0;
  for (int i = 1; i <= tot; i++) {
    int j = i;
    while (j + 1 <= tot && equal(mid[j + 1].first, mid[i].first)) j++;
    long long all = 1, curslope = 0;
    for (int k = i; k <= j; k++) {
      if (k == i || fabs(mid[k].second - mid[k - 1].second) > eps) {
        all = all * (1 + curslope) % mod;
        curslope = 1;
      } else {
        curslope++;
      }
    }
    all = all * (1 + curslope) % mod;
    ans = (ans + all - 1 + mod) % mod;
    i = j;
  }
  ans = (ans - tot % mod + mod) % mod;
  cout << (ans % mod + mod) % mod << endl;
  return 0;
}
