#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res % mod;
}
int main() {
  long long N;
  cin >> N;
  vector<pair<long long, long long>> P(N);
  map<pair<long long, long long>, long long> M;
  long long lz = 0;
  long long rz = 0;
  long long z = 0;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      z++;
    else if (a == 0)
      lz++;
    else if (b == 0)
      rz++;
    else {
      long long aa = abs(a), ab = abs(b);
      long long GCD = gcd(aa, ab);
      a /= GCD, b /= GCD;
      if (a < 0)
        P[i] = {-a, -b};
      else
        P[i] = {a, b};
      M[P[i]]++;
    }
  }
  long long ans = 1;
  ans *= modpow(2, lz, MOD) + modpow(2, rz, MOD) - 1;
  ans %= MOD;
  for (auto m : M) {
    auto p = m.first;
    long long n = M[p];
    if (n == 0) continue;
    long long n_ = 0;
    auto p_ = p;
    long long temp;
    temp = p_.first, p_.first = p_.second, p_.second = temp;
    if (p_.first < 0) {
      p_.first *= -1;
    }
    n_ = M[p_];
    M[p_] = 0;
    if (n_ != 0) {
      ans *= (modpow(2, n, MOD) + modpow(2, n_, MOD)) % MOD - 1;
      ans %= MOD;
    } else {
      ans *= modpow(2, n, MOD);
      ans %= MOD;
    }
  }
  ans += z;
  ans -= 1;
  cout << ans << endl;
}
