#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll pow_mod(ll a, ll n, ll p) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % p;
    a = a * a % p;
    n >>= 1;
  }
  return res;
}
ll gcdf(ll a, ll b) {
  if (b > a) swap(a, b);
  while (a % b) {
    ll tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
int main() {
  ll i, j;
  ll n;
  cin >> n;
  map<pair<ll, ll>, ll> mp;
  map<pair<ll, ll>, ll> seen;
  for (i = 0; i < n; ++i) {
    ll a, b;
    cin >> a >> b;
    ll tmp = gcdf(abs(a), abs(b));
    a /= tmp;
    b /= tmp;
    if (a < 0 || (a == 0 && b < 0)) {
      a /= -1;
      b /= -1;
    }
    ++mp[make_pair(a, b)];
    seen[make_pair(a, b)] = 0;
  }
  const ll MOD = 1e9 + 7;
  ll spare = n;
  vector<pair<ll, ll>> dame;
  for (auto x : mp) {
    if (seen[x.first] == 1) continue;
    seen[x.first] = 1;
    ll c = x.first.first;
    ll d = x.first.second;
    ll n1 = x.second;
    ll n2 = 0;
    if (seen.count(make_pair(d, -c))) {
      n2 = mp[make_pair(d, -c)];
      seen[make_pair(d, -c)] = 1;
      dame.emplace_back(n1, n2);
      spare -= n1 + n2;
    }
  }
  ll ans = 1;
  for (auto x : dame) {
    ans *= (pow_mod(2ll, x.first, MOD) + pow_mod(2ll, x.second, MOD) - 1);
    ans %= MOD;
  }
  ans *= pow_mod(2ll, spare, MOD);
  cout << (ans + MOD - 1) % MOD << endl;
  return 0;
}
