#include <bits/stdc++.h>

#include <boost/rational.hpp>

#define REP(i, n) for (decltype(n) i = 0; i < (n); ++i)
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
using boost::rational;

const i64 MOD = 1000000007;

int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  i64 N;
  cin >> N;
  i64 cnt_ab0 = 0, cnt_a0 = 0, cnt_b0 = 0;
  map<rational<i64>, i64> cnt_r;

  REP(i, N) {
    i64 a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ++cnt_ab0;
    } else if (a == 0) {
      ++cnt_a0;
    } else if (b == 0) {
      ++cnt_b0;
    } else {
      rational<i64> r{a, b};
      ++cnt_r[move(r)];
    }
  }

  set<rational<i64>> rpairs;
  for (const auto& [r, val] : cnt_r) {
    if (r > 0) {
      rpairs.insert(r);
    } else {
      rpairs.insert(-1 / r);
    }
  }

  vector<i64> pow2(N + 1);
  pow2[0] = 1;
  REP(i, N) { pow2[i + 1] = (pow2[i] << 1) % MOD; }

  i64 ans = 1LL;
  for (const auto& r1 : rpairs) {
    rational<i64> r2 = rational<i64>(-1) / r1;
    i64 p = pow2[cnt_r[r1]] + pow2[cnt_r[r2]] + MOD - 1;
    ans *= p % MOD;
    ans %= MOD;
  }
  i64 p = pow2[cnt_r[cnt_a0]] + pow2[cnt_r[cnt_b0]] + MOD - 1;
  ans *= p % MOD;
  ans %= MOD;
  ans += cnt_ab0 + MOD - 1;
  cout << (ans % MOD) << endl;
}