#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const int INF = 2e9;
const long long LINF = 1e18 + 5;
const long long MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int MN = 1e6 + 2;
double x[1001];
double y[1001];
vector<pair<pair<double, double>, double> > v;
int le[MN];
int ri[MN];
bool eq(int idx) {
  double rx1 = v[idx - 1].first.first;
  double ry1 = v[idx - 1].first.second;
  double rx2 = v[idx].first.first;
  double ry2 = v[idx].first.second;
  if (abs(rx1 - rx2) < 1e-9 && abs(ry1 - ry2) < 1e-9)
    return 1;
  else
    return 0;
}
bool tcmp(pair<pair<double, double>, double> d1,
          pair<pair<double, double>, double> d2) {
  if (abs(d1.first.first - d2.first.first) > 1e-9)
    return d1.first.first < d2.first.first;
  if (abs(d1.first.second - d2.first.second) > 1e-9)
    return d1.first.second < d2.first.second;
  if (abs(d1.second - d2.second) > 1e-9) return d1.second < d2.second;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  double mm;
  int a, b, c, d;
  for (int i = 0; i < n; ++i) {
    cin >> a >> b >> c >> d;
    double xx = (1.0 * a) / b;
    double yy = (1.0 * c) / d;
    x[i] = xx / (((xx) * (xx)) + ((yy) * (yy)));
    y[i] = yy / (((xx) * (xx)) + ((yy) * (yy)));
  }
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      double rx = x[i] + x[j];
      double ry = y[i] + y[j];
      if (abs(x[i] - x[j]) < 1e-9)
        mm = 1e50;
      else
        mm = (y[i] - y[j]) / (x[i] - x[j]);
      v.push_back(make_pair(make_pair(rx, ry), mm));
    }
  }
  sort((v).begin(), (v).end(), tcmp);
  v.push_back(make_pair(make_pair(-1e50, -1e50), -1e50));
  int _sz = 1;
  le[_sz - 1] = 0;
  for (int i = 1; i < v.size(); ++i) {
    if (!eq(i)) {
      ri[_sz - 1] = i - 1;
      le[_sz] = i;
      ++_sz;
    }
  }
  --_sz;
  long long ans = 0;
  long long u = 1;
  long long ret = 0;
  vector<int> ss;
  for (int i = 0; i < _sz; ++i) {
    ss.clear();
    ss.push_back(1);
    for (int j = le[i] + 1; j <= ri[i]; ++j) {
      if (abs(v[j].second - v[j - 1].second) < 1e-9) {
        int len = ss.size();
        ss[len - 1]++;
      } else {
        ss.push_back(1);
      }
    }
    ret = 0;
    u = 1;
    for (int j = 0; j < ss.size(); ++j) {
      u = (u * (ss[j] + 1)) % MOD;
      ret += ss[j];
    }
    ans = (ans + u - ret - 1) % MOD;
  }
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}
