#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const long long MAX = 200001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (long long 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(long long n, long long 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 powMOD(long long n, long long r) {
  if (r <= 0) return 1;
  if (r % 2 == 0) return powMOD(n, r / 2) * powMOD(n, r / 2) % MOD;
  if (r % 2 == 1) return powMOD(n, r - 1) * n % MOD;
}
signed main() {
  long long N;
  cin >> N;
  double X[N], Y[N];
  for (long long i = (0); i < (N); ++i) X[i] = INF;
  map<double, long long> umemo;
  map<double, long long> smemo;
  map<double, bool> used;
  long long Ac = 0, Bc = 0;
  long long cc = 0;
  for (long long i = (0); i < (N); ++i) {
    double a, b;
    cin >> a >> b;
    if ((a == 0) || (b == 0)) {
      if (a == 0 && b == 0) {
        cc++;
        continue;
      }
      if (a == 0) Ac++;
      if (b == 0) Bc++;
    }
    X[i] = a / b;
    umemo[a / b]++;
    smemo[(-b / a)]++;
    used[a / b] = false;
  }
  long long ans = 1;
  for (long long i = (0); i < (N); ++i) {
    if (X[i] == INF) continue;
    if (used[X[i]]) continue;
    used[X[i]] = true;
    used[-1.0 / X[i]] = true;
    long long d = 0;
    if (smemo[X[i]] == 0) {
      d = powMOD(2, umemo[X[i]]);
    } else {
      d = -1;
      d = (d + powMOD(2, umemo[X[i]])) % MOD;
      d = (d + powMOD(2, smemo[X[i]])) % MOD;
    }
    while (d < 0) d += MOD;
    ans = ans * d % MOD;
  }
  if (Ac == 0 || Bc == 0) {
    ans = ans * (powMOD(2, max(Ac, Bc))) % MOD;
  } else {
    long long d = -1;
    d = (d + powMOD(2, Ac) % MOD);
    d = (d + powMOD(2, Bc) % MOD);
    ans = ans * d % MOD;
  }
  ans--;
  ans += cc;
  while (ans < 0) ans += MOD;
  cout << ans << endl;
}
