#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
int main() {
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vector<ll> A(N), B(N);
  for (int i = 0; i < (N); ++i) {
    cin >> A[i] >> B[i];
  }
  map<double, int> mp_a_div_b, mp_b_div_a;
  for (int i = 0; i < (N); ++i) {
    if (A[i] == 0 || B[i] == 0) continue;
    mp_a_div_b[double(A[i]) / B[i]] += 1;
    mp_b_div_a[double(B[i]) / A[i]] += 1;
  }
  int a0 = 0, b0 = 0, ab00 = 0;
  for (int i = 0; i < (N); ++i) {
    if (A[i] == 0 && B[i] == 0)
      ab00 += 1;
    else if (A[i] == 0)
      a0 += 1;
    else if (B[i] == 0)
      b0 += 1;
  }
  mint ans;
  mint two = 2;
  mint p = 1;
  p += two.pow(a0) - 1;
  two = 2;
  p += two.pow(b0) - 1;
  ans = p;
  int no_pair = 0;
  vector<pair<int, int>> pairs;
  for (int i = 0; i < (N); ++i) {
    if (A[i] == 0 || B[i] == 0) continue;
    if (!mp_b_div_a.count(-double(A[i]) / B[i])) {
      no_pair += 1;
    }
  }
  for (auto kv : mp_a_div_b) {
    double a_div_b = kv.first;
    int ab_nb = kv.second;
    if (a_div_b <= 0) continue;
    if (mp_b_div_a.count(-a_div_b)) {
      pairs.emplace_back(ab_nb, mp_b_div_a[-a_div_b]);
    }
  }
  two = 2;
  ans *= two.pow(no_pair);
  for (int i = 0; i < (int(pairs.size())); ++i) {
    auto pa = pairs[i];
    mint pl = 1;
    two = 2;
    pl += two.pow(pa.first) - 1;
    two = 2;
    pl += two.pow(pa.second) - 1;
    ans *= pl;
  }
  ans += ab00;
  ans -= 1;
  cout << ans.x << endl;
  return 0;
}
