#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,abm,mmx,tune=native")
using namespace std;
long long gcd(long long i, long long j) {
  if (j == 0)
    return i;
  else
    return gcd(j, i % j);
}
template <typename T>
inline T getint() {
  T val = 0;
  char c;
  bool neg = false;
  while ((c = getchar()) && !(c >= '0' && c <= '9')) {
    neg |= c == '-';
  }
  do {
    val = (val * 10) + c - '0';
  } while ((c = getchar()) && (c >= '0' && c <= '9'));
  return val * (neg ? -1 : 1);
}
const long long INF = 1e9 + 100;
const long long mod = 1000000007;
const long double eps = 1e-10, pi = acosl(-1);
const long long maxN = 70010, maxT = 25000, A = 179, mid = 150;
mt19937 mt_rand(time(0));
long long bp(long long et, long long b) {
  b %= mod - 1;
  long long res = 1;
  for (long long i = 30; i >= 0; --i) {
    res = (res * res) % mod;
    if ((b & (1 << i)) != 0) res = (res * et) % mod;
  }
  return res;
}
void panic() {
  cout << "-1\n";
  exit(0);
}
pair<long long, long long> compr(long long a, long long b) {
  if (a == 0) return {0, 1};
  long long g = gcd(abs(a), abs(b));
  a /= g;
  b /= g;
  if (a < 0) {
    a = -a;
    b = -b;
  }
  return {a, b};
}
pair<long long, long long> rbld(long long a, long long b) {
  if (a == 0) return {0, 1};
  swap(a, b);
  return compr(a, b);
}
pair<long long, long long> midd(pair<long long, long long> f,
                                pair<long long, long long> s) {
  return compr(f.first * s.second + f.second * s.first,
               2 * f.second * s.second);
}
pair<long long, long long> get_v(pair<long long, long long> f,
                                 pair<long long, long long> s) {
  long long aa = f.first * s.second;
  long long bb = f.second * s.first;
  long long cc = f.second * s.second;
  aa -= bb;
  return compr(aa, cc);
}
void solve() {
  long long n;
  cin >> n;
  vector<pair<pair<long long, long long>, pair<long long, long long>>> vi(n);
  for (long long i = 0; i < n; ++i) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    tie(a, b) = compr(a, b);
    tie(c, d) = compr(c, d);
    long long aa, bb, cc, dd;
    aa = a * a;
    bb = b * b;
    cc = c * c;
    dd = d * d;
    aa = (aa * dd + cc * bb);
    bb = bb * dd;
    tie(aa, bb) = compr(aa, bb);
    tie(a, b) = compr(a * bb, b * aa);
    tie(c, d) = compr(c * bb, d * aa);
    vi[i] = {{a, b}, {c, d}};
  }
  long long ans = 0;
  map<tuple<pair<long long, long long>, pair<long long, long long>,
            pair<long long, long long>, pair<long long, long long>>,
      long long>
      mp;
  map<pair<pair<long long, long long>, pair<long long, long long>>, long long>
      mp1;
  for (long long i = 0; i < n; ++i) {
    for (long long j = i + 1; j < n; ++j) {
      pair<long long, long long> x, y;
      x = midd(vi[i].first, vi[j].first);
      y = midd(vi[i].second, vi[j].second);
      pair<long long, long long> x1, y1;
      x1 = get_v(vi[i].first, x);
      y1 = get_v(vi[i].second, y);
      if (x1.first == 0) {
        y1 = {1, 1};
      }
      if (y1.first == 0) {
        x1 = {1, 1};
      }
      if (x1.first != 0 && y1.first != 0) {
        y1.second *= x1.first;
        x1.second *= y1.first;
        x1.first = 1;
        y1.first = 1;
      }
      if (x1.second < 0) {
        x1.second = -x1.second;
        y1.second = -y1.second;
      }
      if (x1.second != 0 && y1.second != 0) {
        long long g = gcd(abs(x1.second), abs(y1.second));
        x1.second /= g;
        y1.second /= g;
      }
      ++mp[make_tuple(x, y, x1, y1)];
      mp1[{x, y}] = 1;
    }
  }
  ans = (mod - n * (n - 1) / 2 - mp1.size()) % mod;
  for (auto tt : mp) {
    pair<long long, long long> x, y;
    tie(x, y, ignore, ignore) = tt.first;
    mp1[{x, y}] = mp1[{x, y}] * (tt.second + 1) % mod;
  }
  for (auto x : mp1) {
    ans = (ans + x.second) % mod;
  }
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
