#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return abs(a);
  T r;
  while ((r = a % b) != 0) a = b, b = r;
  return abs(b);
}
ll modpow(ll b, ll x, ll mod) {
  if (x == 0) return 1;
  if (x & 1) {
    return modpow(b * b % mod, x / 2, mod) * b % mod;
  } else {
    return modpow(b * b % mod, x / 2, mod);
  }
}
int main() {
  int N;
  cin >> N;
  vector<pll> AB(N);
  map<pll, int> cnt;
  for (auto& ab : AB) {
    cin >> ab.first >> ab.second;
    ll g = gcd(ab.first, ab.second);
    ab.first /= g;
    ab.second /= g;
    if (ab.first < 0) {
      ab.first = -ab.first;
      ab.second = -ab.second;
    }
    cnt[ab]++;
  }
  ll ans = 1;
  map<pll, bool> done;
  for (const auto& kv : cnt) {
    const auto& ab = kv.first;
    const auto& c = kv.second;
    if (done[ab]) continue;
    ll a = 1;
    pll abr = make_pair(abs(ab.second), ab.first);
    if (ab.second > 0) abr.second = -abr.second;
    if (cnt.count(abr) > 0) {
      a = (modpow(2, c, 1000000007) + modpow(2, cnt[abr], 1000000007) - 1) %
          1000000007;
      done[abr] = true;
    } else {
      a = modpow(2, c, 1000000007);
    }
    ans = ans * a % 1000000007;
    done[ab] = true;
  }
  if (ans != 1) ans--;
  cout << ans << endl;
}
