#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

const ll mod = 1000000007;

ll modpow(ll b, ll e) {
  ll ans = 1;
  for (; e; b = b * b % mod, e /= 2)
    if (e & 1) ans = ans * b % mod;
  return ans;
}

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  int n;
  cin >> n;

  vl a(n), b(n);
  rep(i,0,n) cin >> a[i] >> b[i];

  map<pair<ll,ll>, int> occ;

  vii cnt;
  pii ex = mp(0,0);
  int ext = 0;
  rep(i,0,n) {
    if (a[i] == b[i] and a[i] == 0) {
      ++ext;
    }

    if (a[i] != 0 and b[i] != 0) {
      ll g = __gcd(abs(a[i]), abs(b[i]));
      pair<ll,ll> f = {a[i] / g, b[i] / g};
      if (f.snd < 0) {
        f.fst *= -1;
        f.snd *= -1;
      }
      ++occ[f];
    } else if (a[i] == 0) {
      ++ex.fst;
    } else {
      ++ex.snd;
    }
  }

  set<pair<ll,ll>> done;
  for (auto x: occ) {
    pair<ll,ll> inv = mp(-x.fst.snd, x.fst.fst);
    if (inv.snd < 0) {
      inv.fst *= -1;
      inv.snd *= -1;
    }
    if (done.find(inv) != done.end()) continue;
    done.insert(x.fst);
    cnt.eb(mp(x.snd, occ[inv]));
  }

  sort(all(cnt));
  ll ans = modpow(2, ex.fst) + modpow(2, ex.snd) - 1;
  for (int i = 0; i < sz(cnt); i++) {
    ans *= (modpow(2, cnt[i].fst) + modpow(2, cnt[i].snd) - 1);
    ans %= mod;
  }

  --ans;
  ans += ext;
  ans %= mod;
  ans += mod;
  ans %= mod;


  cout << ans << '\n';
}
