#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vector<T>>;
template <class T>
inline bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
struct p {
  ld a, b;
  p() {}
  p(ld a, ld b) : a(a), b(b) {}
};
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;
}
ll p2[200005];
int main() {
  init();
  ll N;
  cin >> N;
  vc<p> AB, A, B, E;
  ll ans = 0;
  p2[0] = 1;
  for (ll i = 0; i < (N + 1); i++) p2[i + 1] = 2 * p2[i] % MOD;
  for (ll i = 0; i < (N); i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 and b == 0)
      AB.emplace_back(a, b);
    else if (a == 0)
      A.emplace_back(a, b);
    else if (b == 0)
      B.emplace_back(a, b);
    else {
      E.emplace_back(a, b);
    }
  }
  ans += AB.size();
  ll an = A.size(), bn = B.size(), abn = AB.size();
  map<ld, ll> mp;
  ll en = E.size();
  for (ll i = 0; i < (en); i++) {
    ld a = E[i].a, b = E[i].b;
    mp[a / b]++;
    if (mp[-b / a] == 0) mp[-b / a] = 0;
  }
  vc<ll> ca, cb;
  for (auto& p : mp) {
    ld a = p.first;
    ll acnt = p.second;
    ld d = -1.0L / a;
    if (acnt == 0) {
      continue;
    }
    if (mp[d] > 0) {
      ca.emplace_back(acnt);
      cb.emplace_back(mp[d]);
      mp[d] = 0;
    } else {
      ca.emplace_back(acnt);
      cb.emplace_back(0);
    }
  }
  ll cn = ca.size();
  vc<ll> C(cn);
  for (ll i = 0; i < (cn); i++) {
    C[i] = (p2[ca[i]] + p2[cb[i]] - 1) % MOD;
  }
  vl seki(cn + 1, 1);
  for (ll i = (cn)-1; i >= 0; i--) (seki[i] = seki[i + 1] * C[i]) %= MOD;
  while (an--) {
    (ans += p2[an] * seki[0] % MOD) %= MOD;
  }
  while (bn--) {
    (ans += p2[bn] * seki[0] % MOD) %= MOD;
  }
  for (ll i = 0; i < (cn); i++) {
    while (ca[i]--) {
      (ans += (p2[ca[i]]) * seki[i + 1] % MOD) %= MOD;
    }
    while (cb[i]--) {
      (ans += (p2[cb[i]]) * seki[i + 1] % MOD) %= MOD;
    }
  }
  cout << ans << endl;
}
