#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void _cin() {}
template <class Head, class... Tail>
void _cin(Head &&head, Tail &&...tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}
void _cout() { cout << "\n"; }
template <class Head, class... Tail>
void _cout(Head &&head, Tail &&...tail) {
  cout << head;
  _cout(forward<Tail>(tail)...);
}
ll gcd(ll a, ll b) { return (b == 0) ? a : gcd(b, a % b); }
template <typename S, typename T>
ostream &operator<<(ostream &os, const pair<S, T> &p) {
  cout << "[" << p.first << ", " << p.second << "]";
  return os;
}
constexpr int MOD = 1e9 + 7;
using ll = long long int;
ll modpow(ll N, ll P) {
  if (P == 0) return 1;
  if (P % 2 == 0) {
    ll t = modpow(N, P / 2);
    return t * t % MOD;
  }
  return N * modpow(N, P - 1) % MOD;
}
ll sign(ll a) { return a == 0 ? 0 : a / labs(a); }
int main(void) {
  int n;
  _cin(n);
  vector<ll> a(n), b(n);
  for (int i = 0; i < (n); i++) cin >> a[i] >> b[i];
  map<pair<ll, pair<ll, ll>>, int> sabn;
  for (int i = 0; i < (n); i++) {
    ll s = sign(a[i]) * sign(b[i]);
    a[i] = labs(a[i]), b[i] = labs(b[i]);
    ll d = gcd(a[i], b[i]);
    if (d > 1) a[i] /= d, b[i] /= d;
    sabn[{s, {a[i], b[i]}}]++;
  }
  ll ans = 1;
  for (const auto &[sab, n] : sabn) {
    const auto &[s, ab] = sab;
    if (s == 0) continue;
    const auto &[a, b] = ab;
    int yada = 0;
    if (sabn.find({-s, {b, a}}) != sabn.end()) {
      if (s == -1) continue;
      yada = sabn[{-s, {b, a}}];
    }
    ans = (ans * ((modpow(2, n) + modpow(2, yada) - 1)) % MOD) % MOD;
  }
  ans = (ans *
         ((modpow(2, sabn[{0, {1, 0}}]) + modpow(2, sabn[{0, {0, 1}}]) - 1)) %
         MOD) %
        MOD;
  _cout(ans - 1 + sabn[{0, {0, 0}}]);
}
