#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
inline long long read() {
  long long s = 0, ww = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') ww = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    s = 10 * s + ch - '0';
    ch = getchar();
  }
  return s * ww;
}
namespace ModCalc {
inline void Inc(long long &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
}
inline void Dec(long long &x, long long y) {
  x -= y;
  if (x < 0) x += mod;
}
inline long long Add(long long x, long long y) {
  Inc(x, y);
  return x;
}
inline long long Sub(long long x, long long y) {
  Dec(x, y);
  return x;
}
}  // namespace ModCalc
using namespace ModCalc;
inline int sgn(double x) { return x < -1e-9 ? -1 : x > 1e-9; }
struct vec {
  double x, y;
  vec() {}
  vec(double _x, double _y) { x = _x, y = _y; }
  inline friend vec operator+(vec a, vec b) {
    return vec(a.x + b.x, a.y + b.y);
  }
  inline friend vec operator-(vec a, vec b) {
    return vec(a.x - b.x, a.y - b.y);
  }
  inline friend vec operator*(vec a, double k) { return vec(a.x * k, a.y * k); }
  inline friend vec operator/(vec a, double k) { return vec(a.x / k, a.y / k); }
  inline friend double Dot(vec a, vec b) { return a.x * a.x + b.y * b.y; }
  inline friend double Cross(vec a, vec b) { return a.x * b.y - a.y * b.x; }
  inline friend bool equ(vec a, vec b) {
    return sgn(a.x - b.x) == 0 && sgn(a.y - b.y) == 0;
  }
} p[1000 + 5];
struct line {
  vec m, v;
  line() {}
  line(vec _m, vec _v) { m = _m, v = _v; }
} l[1000 * 1000 + 5];
int ln;
inline vec Adjust(vec a) {
  int k;
  if ((k = sgn(a.x)) < 0)
    a.x = -a.x, a.y = -a.y;
  else if (k == 0) {
    if (sgn(a.y) > 0) a.y = -a.y;
  }
  return a;
}
inline bool cmp(line a, line b) {
  int k;
  if ((k = sgn(a.m.x - b.m.x)) != 0) return k < 0;
  if ((k = sgn(a.m.y - b.m.y)) != 0) return k < 0;
  return sgn(Cross(a.v, b.v)) == 1;
}
long long ans, n;
long long a[1000 * 1000 + 5], an;
void Count() {
  long long cur = 1;
  for (register int i = 1; i <= an; i++) cur = cur * (a[i] + 1) % mod;
  Dec(cur, 1);
  for (register int i = 1; i <= an; i++) Dec(cur, a[i]);
  Inc(ans, cur);
  an = 0;
}
int main() {
  n = read();
  for (register int i = 1; i <= n; i++) {
    int a = read(), b = read(), c = read(), d = read();
    double x = (double)a / b, y = (double)c / d;
    double k = 1 / (x * x + y * y);
    p[i] = vec(x, y) * k;
  }
  for (register int i = 1; i < n; i++) {
    for (register int j = i + 1; j <= n; j++) {
      ln++;
      l[ln].m = (p[i] + p[j]) / 2;
      l[ln].v = Adjust(p[i] - p[j]);
    }
  }
  sort(l + 1, l + ln + 1, cmp);
  for (register int i = 1; i <= ln; i++) {
    if (i == 1 || !equ(l[i].m, l[i - 1].m)) {
      if (i != 1) Count();
      a[++an] = 1;
    } else if (sgn(Cross(l[i].v, l[i - 1].v)) == 0)
      a[an]++;
    else
      a[++an] = 1;
  }
  Count();
  cout << ans << endl;
  return 0;
}
