#include <bits/stdc++.h>
using namespace std;
using LD = long double;
const int64_t MAX = 510000;
const int64_t MOD = 1000000007;
int64_t 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;
  }
}
int64_t COM(int64_t n, int64_t k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int64_t powmod(int64_t x, int64_t n) {
  int64_t ans = 1;
  while (n > 0) {
    if ((n & 1) == 1) {
      ans = ans * x;
      ans %= MOD;
    }
    x = x * x;
    x %= MOD;
    n >>= 1;
  }
  return ans;
}
int main() {
  int N;
  cin >> N;
  vector<LD> A(N);
  vector<LD> B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    cin >> B[i];
  }
  vector<LD> AB(N);
  vector<LD> BA(N);
  for (int i = 0; i < N; i++) {
    if (A[i] == 0 || B[i] == 0) {
      AB[i] = 0;
      BA[i] = 0;
    } else {
      AB[i] = A[i] / B[i];
      BA[i] = B[i] / A[i];
    }
  }
  map<LD, int> mp;
  int64_t cnt = 0;
  for (int i = 0; i < N; i++) {
    if (mp.count(AB[i])) {
      mp[AB[i]]++;
    } else {
      mp[AB[i]] = 1;
    }
    int x = 0;
    if (A[i] == 0 || B[i] == 0) {
      x = mp[0];
      x--;
    } else {
      if (mp.count(BA[i] * -1)) {
        x = mp[BA[i] * -1];
      }
    }
    if (x > 0) {
      cnt += x;
    }
  }
  COMinit();
  int64_t ans = powmod(2, N) - 1;
  int64_t out = 0;
  for (int i = 1; i <= cnt; i++) {
    if (i % 2 == 1) {
      out += COM(cnt, i) * powmod(2, N - 2 * i);
      out %= MOD;
    } else {
      out -= COM(cnt, i) * powmod(2, N - 2 * i);
      out %= MOD;
      if (out < 0) {
        out += MOD;
      }
    }
  }
  ans -= out;
  while (ans < 0) {
    ans += MOD;
  }
  cout << ans % MOD << endl;
}
