#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln = '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int MAX = 210000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long Com(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long Perm(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * finv[n - k] % MOD;
}
int main() {
  COMinit();
  int n;
  cin >> n;
  vector<ll> A(n), B(n);
  for (int i = 0; i < (n); i++) {
    cin >> A[i] >> B[i];
  }
  map<double, ll> mp;
  int zeroA = 0, zeroB = 0;
  ll ng = 0;
  for (int i = 0; i < (n); i++) {
    if (A[i] == 0) {
      zeroA++;
      ng += zeroB;
    } else if (B[i] == 0) {
      zeroB++;
      ng += zeroA;
    } else {
      double A_B = (double)A[i] / B[i], B_A = (double)B[i] / A[i];
      ng += mp[-A_B];
      mp[B_A]++;
    }
  }
  cout << "ng:" << ng << ln;
  ll sum = 0;
  for (int i = (1); i < (n + 1); i++) {
    if (i == 1)
      sum += n;
    else if (i == n) {
      if (!ng) sum = (sum + 1) % MOD;
    } else {
      ll none = ng % MOD * Com(n - i, i - 2) % MOD;
      ll tmp = (Com(n, i) + MOD - none) % MOD;
      sum = (sum + tmp) % MOD;
    }
  }
  cout << sum << ln;
}
