#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;
template <class T, class U>
using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
ll powmod(ll m, ll p) {
  if (p == 0) return 1;
  ll tmp = powmod(m, p / 2);
  if (p & 1)
    return (tmp * tmp % MOD) * m % MOD;
  else
    return tmp * tmp % MOD;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  map<P<ll, ll>, ll> abm;
  ll abz = 0, aorbz = 0;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      abz++;
      continue;
    } else if (a == 0 || b == 0) {
      aorbz++;
    } else {
      bool ma = a < 0, mb = b < 0;
      a = abs(a), b = abs(b);
      ll g = gcd(a, b);
      a /= g, b /= g;
      if (ma ^ mb) b = -b;
      abm[make_pair(a, b)]++;
    }
  }
  ll ans = 1;
  while (!abm.empty()) {
    auto it = abm.begin();
    abm.erase(it);
    ll tmp = powmod(2, it->second);
    tmp = (tmp - 1 + MOD) % MOD;
    if (!abm.empty() && abm.find(make_pair(-(it->first.second),
                                           it->first.first)) != abm.end()) {
      auto it2 = abm.find(make_pair(-(it->first.second), it->first.first));
      abm.erase(it2);
      (tmp += powmod(2, it2->second)) %= MOD;
      tmp = (tmp - 1 + MOD) % MOD;
    }
    if (!abm.empty() && abm.find(make_pair((it->first.second),
                                           -(it->first.first))) != abm.end()) {
      auto it2 = abm.find(make_pair((it->first.second), -(it->first.first)));
      abm.erase(it2);
      (tmp += powmod(2, it2->second)) %= MOD;
      tmp = (tmp - 1 + MOD) % MOD;
    }
    tmp = (tmp + 1) % MOD;
    (ans *= tmp) %= MOD;
  }
  (ans *= (aorbz + 1)) %= MOD;
  (ans += abz) %= MOD;
  cout << (ans - 1 + MOD) % MOD << '\n';
  return 0;
}
