#include <bits/stdc++.h>
using namespace std;
using ll = long long;
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<long double, int> m;
  m[0.0] = 0;
  int B_zero = 0;
  for (int i = 0; i < N; i++) {
    if (B.at(i) == 0) {
      B_zero++;
      continue;
    }
    m[(long double)A.at(i) / (long double)B.at(i)]++;
  }
  ll ans = 1;
  set<long double> s;
  for (auto p : m) {
    long double x = p.first;
    if (s.count(x) == 1) {
      continue;
    }
    if (x == 0.0) {
      if (B_zero == 0) {
        ans *= modpow(2, p.second, 1000000007);
      } else {
        ans *=
            (modpow(2, p.second, 1000000007) + modpow(2, B_zero, 1000000007)) %
            1000000007;
      }
      continue;
    }
    if (m[-1.0 / x] == 0) {
      ans *= modpow(2, p.second, 1000000007);
      ans %= 1000000007;
    } else {
      ans *= (modpow(2, p.second, 1000000007) +
              modpow(2, m[-1.0 / x], 1000000007) + 1000000007 - 1) %
             1000000007;
      ans %= 1000000007;
    }
    s.insert(x);
    s.insert(-1.0 / x);
  }
  cout << (ans + 1000000007 - 1) % 1000000007 << endl;
}
