#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) {
  while (a % b != 0) {
    ll tmp = a % b;
    a = b;
    b = tmp;
  }
  return b;
}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) {
      res = (res * a) % mod;
    }
    a = (a * a) % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  int N;
  cin >> N;
  vector<ll> A(N), B(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i) >> B.at(i);
  }
  map<pair<ll, ll>, int> m;
  for (int i = 0; i < N; i++) {
    if (A.at(i) == 0 && B.at(i) == 0) {
      m[make_pair(0, 0)]++;
    } else if (A.at(i) == 0) {
      m[make_pair(0, 1)]++;
    } else if (B.at(i) == 0) {
      m[make_pair(0, 1)]++;
    } else {
      ll x = gcd(abs<ll>(A.at(i)), abs<ll>(B.at(i)));
      if ((A.at(i) > 0 && B.at(i) > 0) || (A.at(i) < 0 && B.at(i) < 0)) {
        m[make_pair(abs<ll>(A.at(i)) / x, abs<ll>(B.at(i)) / x)]++;
      } else {
        m[make_pair(abs<ll>(A.at(i) / x), -abs<ll>(B.at(i) / x))]++;
      }
    }
  }
  ll ans = 1;
  set<pair<ll, ll>> s;
  for (auto p : m) {
    ll a = p.first.first;
    ll b = p.first.second;
    if (s.count(p.first) == 1) {
      continue;
    }
    if (m[make_pair(b, -a)] == 0) {
      ans *= modpow(2, p.second, 1000000007);
    } else {
      ans *= (modpow(2, p.second, 1000000007) +
              modpow(2, m[make_pair(b, a)], 1000000007) - 1) %
             1000000007;
    }
    s.insert(make_pair(a, b));
    s.insert(make_pair(b, a));
  }
  cout << (ans + m[make_pair(0, 0)] + 1000000007 - 1) % 1000000007 << endl;
}
