#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll mod_pow(ll x, ll p) {
  ll res = 1;
  ll n = x;
  while (p > 0) {
    if ((p & 1) == 1) res = (res * n) % 1000000007;
    n = (n * n) % 1000000007;
    p = (p >> 1);
  }
  return res;
}
ll gcd(ll a, ll b) {
  ll m = max(abs(a), abs(b));
  ll n = min(abs(a), abs(b));
  while (n != 0) {
    ll tmp = n;
    n = m % n;
    m = tmp;
  }
  return m;
}
int main() {
  int N;
  cin >> N;
  map<pair<ll, ll>, ll> piwashi;
  map<pair<ll, ll>, ll> miwashi;
  ll zero = 0;
  for (int i = 0; i < N; i++) {
    ll A, B;
    cin >> A >> B;
    if (A == 0 && B == 0) {
      zero++;
      continue;
    }
    ll g = gcd(A, B);
    A /= g;
    B /= g;
    if (A < 0) {
      A *= -1;
      B *= -1;
    }
    if (B <= 0) {
      miwashi[make_pair(A, B)] = miwashi[make_pair(A, B)] + 1;
    } else {
      piwashi[make_pair(A, B)] = piwashi[make_pair(A, B)] + 1;
    }
  }
  ll ans = 1;
  for (auto x : piwashi) {
    auto key = x.first;
    ll tmp = mod_pow(2, x.second);
    pair<ll, ll> bad = make_pair(key.second, -key.first);
    tmp += mod_pow(2, miwashi[bad]);
    tmp--;
    tmp %= 1000000007;
    miwashi.erase(bad);
    ans *= tmp;
    ans %= 1000000007;
  }
  for (auto x : miwashi) {
    ans *= mod_pow(2, x.second);
    ans %= 1000000007;
  }
  ans--;
  ans += zero;
  ans += 1000000007;
  ans %= 1000000007;
  cout << ans << endl;
}
