#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
constexpr ll MOD = 1e9 + 7;
ll modpow(ll x, ll p) {
  ll u = x;
  ll t = 1;
  while (p) {
    if (p & 1) (t *= u) %= MOD;
    (u *= u) %= MOD;
    p >>= 1;
  }
  return t;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  map<pair<ll, ll>, int> AB;
  int zz = 0, ze = 0, ez = 0;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a != 0 and b != 0) {
      if (b < 0) {
        a *= -1;
        b *= -1;
      }
      auto g = gcd(abs(a), abs(b));
      a /= g;
      b /= g;
      AB[{a, b}]++;
    } else if (a == 0 and b == 0) {
      zz++;
    } else if (a == 0) {
      ze++;
    } else {
      ez++;
    }
  }
  if (zz == n) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = 1;
  for (auto it = AB.begin(); it != AB.end(); ++it) {
    auto [k, c] = *it;
    if (c == 0) continue;
    auto [a, b] = k;
    ll p;
    auto invkey = make_pair(-b, a);
    if (a < 0) {
      invkey.first *= -1;
      invkey.second *= -1;
    }
    auto inv = AB.find(invkey);
    if (inv != AB.end()) {
      (p = modpow(2, c) + modpow(2, inv->second) - 1) %= MOD;
      inv->second = 0;
    } else {
      p = modpow(2, c);
    }
    (ans *= p) %= MOD;
  }
  (ans *= modpow(2, ze) + modpow(2, ez) - 1) %= MOD;
  cout << (ans + MOD - 1) % MOD << endl;
  return 0;
}
