#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
using ll = long long;
using P = pair<ll, ll>;
template <typename T>
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while (n > 0) {
    if (n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
void solve(long long N, std::vector<long long> A, std::vector<long long> B) {
  if (N == 1) {
    cout << 1 << endl;
    return;
  }
  map<P, ll> mp;
  ll zeroNum = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] == 0 && B[i] == 0) {
      zeroNum++;
      continue;
    }
    if (A[i] == 0) {
      mp[P(0, 1)]++;
      continue;
    }
    if (B[i] == 0) {
      mp[P(1, 0)]++;
      continue;
    }
    if (A[i] * B[i] < 0) {
      ll g = gcd(abs(A[i]), abs(B[i]));
      mp[P(-(abs(A[i]) / g), abs(B[i]) / g)]++;
    } else {
      ll g = gcd(abs(A[i]), abs(B[i]));
      mp[P(abs(A[i]) / g, abs(B[i]) / g)]++;
    }
  }
  ll ans = 1ll;
  map<P, bool> already;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    P p = itr->first;
    P np;
    if (p.first <= 0) {
      np = P(p.second, -p.first);
    } else {
      np = P(-p.second, p.first);
    }
    if (mp.find(np) == mp.end()) {
      ans *= mod_pow(2ll, itr->second, MOD);
      ans %= MOD;
    } else {
      if (already.find(p) != already.end()) {
        continue;
      }
      already[p] = true;
      already[np] = true;
      ans = ans *
            ((mod_pow(2ll, mp[p], MOD) + mod_pow(2ll, mp[np], MOD) - 1 + MOD) %
             MOD);
      ans %= MOD;
    }
  }
  cout << (ans + zeroNum - 1 + MOD) % MOD << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  std::vector<long long> B(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
    scanf("%lld", &B[i]);
  }
  solve(N, std::move(A), std::move(B));
  return 0;
}
