#include <bits/stdc++.h>
using namespace std;
const int maxn = 1111;
const double eps = 1e-8;
const double PI = acos(-1.0);
const long long mod = 1000000007;
int sign(double x) {
  if (abs(x) < eps) return 0;
  if (x > eps) return 1;
  return -1;
}
struct node {
  double x, y, a;
  bool operator<(const node &b) const {
    if (sign(x - b.x)) return sign(x - b.x) < 0;
    if (sign(y - b.y)) return sign(y - b.y) < 0;
    return sign(a - b.a) < 0;
  }
} p[maxn * maxn];
int n;
double x[maxn], y[maxn];
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) {
      double tx, ty;
      scanf("%lf%lf", &tx, &ty);
      x[i] = tx / ty;
      scanf("%lf%lf", &tx, &ty);
      y[i] = tx / ty;
      double d = x[i] * x[i] + y[i] * y[i];
      x[i] /= d, y[i] /= d;
    }
    int res = 0;
    for (int i = 1; i <= n; i++)
      for (int j = i + 1; j <= n; j++) {
        p[res].x = 0.5 * (x[i] + x[j]), p[res].y = 0.5 * (y[i] + y[j]);
        double temp = atan2(y[j] - y[i], x[j] - x[i]);
        if (sign(temp) < 0) temp += PI;
        if (sign(temp - PI) >= 0) temp -= PI;
        p[res++].a = temp;
      }
    sort(p, p + res);
    long long ans = 0, sum1, sum2;
    for (int i = 0; i < res; i++) {
      int j = i;
      sum1 = sum2 = 0;
      while (j < res && sign(p[j].x - p[i].x) == 0 &&
             sign(p[j].y - p[i].y) == 0) {
        int k = j;
        while (j < res && !(p[k] < p[j])) j++;
        sum2 = (sum2 + (sum1 + sum2) * (j - k) % mod) % mod;
        sum1 = (sum1 + j - k) % mod;
      }
      ans = (ans + sum2) % mod;
      i = j - 1;
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
