#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1e9 + 7;
using P = pair<ll, ll>;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll mod_pow(ll x, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) {
      res = res * x % MOD;
    }
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  map<P, ll> ma;
  for (int i = 0; i < n; i++) {
    if (a[i] < 0) {
      a[i] *= -1;
      b[i] *= -1;
    }
    ll g = gcd(a[i], b[i]);
    ma[P(a[i] / g, b[i] / g)]++;
  }
  vector<ll> count;
  while (!ma.empty()) {
    auto itr = ma.begin();
    P p = itr->first;
    ll c = itr->second;
    ll x = p.first;
    ll y = p.second;
    ll tx = y;
    ll ty = x;
    if (y < 0)
      tx *= -1;
    else
      ty *= -1;
    if (ma.find(P(tx, ty)) != ma.end()) {
      ll tc = ma[P(tx, ty)];
      count.push_back((mod_pow(2, c) + mod_pow(2, tc) - 1) % MOD);
      ma.erase(P(tx, ty));
    } else {
      count.push_back(mod_pow(2, c));
    }
    ma.erase(p);
  }
  ll ans = 1;
  for (ll c : count) {
    ans = ans * c % MOD;
  }
  ans = (ans - 1 + MOD) % MOD;
  cout << ans << endl;
}
