#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}};
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
ll modpow(ll a, ll t) {
  if (t < 0) assert(false);
  ll ret = 1LL;
  while (t) {
    if (t & 1LL) {
      ret *= a;
      ret %= MOD;
    }
    a *= a;
    a %= MOD;
    t >>= 1;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  ll a, b, x = 0, y = 0, z = 0;
  map<Pll, ll> mp;
  for (int i = 0; i < n; ++i) {
    cin >> a >> b;
    ll g = gcd(a, b);
    a /= g;
    b /= g;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    if (a == 0) {
      if (b == 0)
        ++z;
      else
        ++y;
    } else {
      if (b == 0)
        ++x;
      else
        ++mp[{a, b}];
    }
  }
  ll ans = 1LL;
  vector<Pll> p;
  if (x != 0) {
    p.emplace_back(x, y);
  } else if (y != 0) {
    p.emplace_back(y, x);
  }
  for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
    tie(a, b) = (itr->first);
    if (mp.find({-b, a}) != mp.end()) {
      if (Pii(a, b) < Pii(-b, a)) {
        p.emplace_back(itr->second, mp[{-b, a}]);
      }
    } else if (mp.find({b, -a}) != mp.end()) {
      if (Pii(a, b) < Pii(b, -a)) {
        p.emplace_back(itr->second, mp[{b, -a}]);
      }
    } else {
      p.emplace_back(itr->second, 0);
    }
  }
  for (Pll q : p) {
    tie(a, b) = q;
    if (b == 0) {
      ans *= modpow(2LL, a);
    } else {
      ans *= (((modpow(2LL, a) + modpow(2LL, b)) % MOD) + MOD - 1LL) % MOD;
    }
    ans %= MOD;
  }
  ans += MOD - 1;
  ans %= MOD;
  ans += z;
  ans %= MOD;
  cout << ans << endl;
}
