//In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define double long double 
#define fi first
#define se second
#define pii pair<int, int>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

const int mod = 1e9 + 7;
signed main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
  int n;
  cin >> n;
  pii a[n];
  int z1 = 0, z2 = 0, z3 = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i].fi >> a[i].se;
    if (a[i].fi * a[i].se != 0) {
      int g = __gcd(a[i].fi, a[i].se);
      a[i].fi /= g, a[i].se /= g;
      if (a[i].se < 0) {
        a[i].fi *= -1, a[i].se *= -1;
      }
    } else if (a[i].fi != 0) {
      z2++;
    } else if (a[i].se != 0) {
      z1++;
    } else {
      z3++;
    }
  }
  map<pii, int> cnt;
  set<pii> st;
  for (int i = 0; i < n; i++) {
    int x = a[i].fi, y = a[i].se;
    if (x == 0 || y == 0) continue;
    cnt[{x, y}]++;
    st.insert({x, y}); 
    if (x > 0) {
      st.insert({-y, x});
    } else {
      st.insert({y, -x});
    }
  }
  int N = 2e5 + 1000;
  int p2[N];
  p2[0] = 1;
  for (int i = 1; i < N; i++) {
    p2[i] = p2[i - 1] * 2 % mod;
  }
  int ans = 1;
  for (auto &el : st) {
    if (el.fi < 0) continue;
    ans *= (p2[cnt[el]] + p2[cnt[{-el.se, el.fi}]] + -1) % mod;
    ans %= mod;
  }
  ans *= (p2[z1] + p2[z2] - 1);
  ans += z3 - 1;
  ans %= mod;
  cout << ans << "\n";
}

