#include <bits/stdc++.h>

#define fi first
#define se second
using namespace std;
using ll = long long;
using Pll = pair<ll, ll>;
constexpr ll MOD = 1000000007;

ll modpow(ll a, ll n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret = ret * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return ret;
}

int main() {
  int N;
  cin >> N;
  vector<Pll> AB(N);
  map<Pll, Pll> mp;
  ll zero = 0;
  for (auto &p : AB) {
    cin >> p.fi >> p.se;
    if (p.fi == 0 && p.se == 0) {
      zero++;
    } else if (p.fi == 0) {
      mp[Pll(0, 1)].fi++;
    } else if (p.se == 0) {
      mp[Pll(0, 1)].se++;
    } else {
      ll gc = gcd(abs(p.fi), abs(p.se));
      p.fi /= gc;
      p.se /= gc;
      if (p.fi < 0) {
        p.fi = -p.fi;
        p.se = -p.se;
      }
      if (p.second > 0)
        mp[p].fi++;
      else
        mp[Pll(-p.se, p.fi)].se++;
    }
  }
  ll ans = 1;
  for (auto p : mp)
    ans = ans * (modpow(2, p.se.fi) + modpow(2, p.se.se) - 1) % MOD;
  cout << ((ans + zero - 1) % MOD) << endl;
  return 0;
}