#include <bits/stdc++.h>
using namespace std;
const int NN = 1010;
double first[NN], second[NN];
int main() {
  int n, a, b, c, d;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d%d%d%d", &a, &b, &c, &d);
    double s = a * a * d * d + c * c * b * b;
    first[i] = a * b * d * d / s;
    second[i] = c * b * b * d / s;
  }
  const double eps = 1e-9;
  vector<pair<pair<double, double>, double> > line(n * (n - 1) / 2);
  for (int i = 0, id = 0; i < n; i++)
    for (int j = i + 1; j < n; j++, id++) {
      line[id] =
          make_pair(make_pair(first[i] + first[j], second[i] + second[j]),
                    fabs(first[i] - first[j]) < eps
                        ? 1e9
                        : (second[i] - second[j]) / (first[i] - first[j]));
    }
  sort(line.begin(), line.end(),
       [&](const pair<pair<double, double>, double> &a,
           const pair<pair<double, double>, double> &b) {
         if (fabs(a.first.first - b.first.first) > eps)
           return a.first.first < b.first.first;
         if (fabs(a.first.second - b.first.second) > eps)
           return a.first.second < b.first.second;
         return a.second < b.second - eps;
       });
  auto cmp1 = [&](double first, double second) {
    return fabs(first - second) < eps;
  };
  auto cmp = [&](pair<double, double> first, pair<double, double> second) {
    return cmp1(first.first, second.first) && cmp1(first.second, second.second);
  };
  int ans = 0;
  const int mod = 1000000007;
  for (int i = 0, j, k; i < line.size(); i = j) {
    int mid = 1;
    for (j = i; j < line.size() && cmp(line[i].first, line[j].first); j = k) {
      for (k = j; k < line.size() && cmp(line[k].first, line[j].first) &&
                  cmp1(line[j].second, line[k].second);
           k++)
        ;
      mid = (long long)mid * (k - j + 1) % mod;
    }
    mid = (mid + mod - 1 - j + i) % mod;
    ans += mid;
    if (ans >= mod) ans -= mod;
  }
  cout << ans << endl;
  return 0;
}
