#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1& a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1& a, T2 b) {
  if (a < b) a = b;
}
std::random_device rd;
std::mt19937 mt(rd());
constexpr long long MOD = 1e9 + 7;
constexpr long long MAX = 200020;
const double pi = acos(-1);
constexpr long long INF = 1e16;
void yes(bool c) {
  if (c)
    cout << ("Yes") << '\n';
  else
    cout << ("No") << '\n';
};
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (long long i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long add(long long x, long long y) {
  x += y;
  if (x >= MOD) return x - MOD;
  return x;
}
long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) return x + MOD;
  return x;
}
long long mult(long long x, long long y) { return (x * y) % MOD; }
long long bin_pow(long long x, long long p) {
  if (p == 0) return 1;
  if (p & 1) return mult(x, bin_pow(x, p - 1));
  return bin_pow(mult(x, x), p / 2);
}
template <typename T>
struct SegmentTree {
  long long n;
  T unit;
  vector<T> dat;
  function<T(T, T)> func;
  SegmentTree(const long long N, T _unit, function<T(T, T)> _func)
      : unit(_unit), func(_func) {
    n = 1;
    while (n < N) n *= 2;
    dat.assign(2 * n, unit);
  }
  void update(long long k, T a) {
    k += n - 1;
    dat[k] = a;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = func(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }
  T _query(long long a, long long b, long long k, long long l, long long r) {
    if (r <= a || b <= l) return unit;
    if (a <= l && r <= b)
      return dat[k];
    else {
      long long vl = _query(a, b, k * 2 + 1, l, (l + r) / 2);
      long long vr = _query(a, b, k * 2 + 2, (l + r) / 2, r);
      return func(vl, vr);
    }
  }
  T query(long long a, long long b) { return _query(a, b, 0, 0, n); }
};
long long gcd(long long x, long long y) {
  long long m = max(x, y), n = min(x, y);
  if (n == 0) return m;
  if (m % n == 0)
    return n;
  else
    return gcd(m % n, n);
}
const long long mod = 1000000007;
struct mint {
  long long x;
  mint(long long 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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long 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 { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
pair<long long, long long> Q(long long x, long long y) {
  long long g = gcd(x, y);
  x /= g, y /= g;
  return {x, y};
}
void solve() {
  long long N;
  cin >> N;
  vector<long long> A(N), B(N);
  for (long long i = 0; i < (N); ++i) {
    cin >> A[i] >> B[i];
  }
  auto f = [](long long a, long long b) { return ((a + b) % MOD + MOD) % MOD; };
  SegmentTree<long long> seg(N + 1, 0, f);
  long long a0 = 0, b0 = 0;
  mint ab0 = 0;
  map<pair<long long, long long>, long long> lp, lm, rp, rm;
  for (long long i = 0; i < (N); ++i) {
    if (A[i] == 0 && B[i] == 0) {
      ab0 += 1;
    } else if (A[i] == 0) {
      a0 += 1;
    } else if (B[i] == 0) {
      b0 += 1;
    } else {
      if (A[i] > 0 == B[i] > 0) {
        lp[Q(abs(A[i]), abs(B[i]))]++;
        rp[Q(abs(B[i]), abs(A[i]))]++;
      } else {
        lm[Q(abs(A[i]), abs(B[i]))]++;
        rm[Q(abs(B[i]), abs(A[i]))]++;
      }
    }
  }
  mint ans = 0;
  ans += ab0;
  vector<mint> v;
  mint tw(2);
  if (a0 || b0) {
    mint tm = tw.pow(a0) + tw.pow(b0) - 1;
    v.push_back(tm);
  }
  for (auto x : lp) {
    pair<long long, long long> p = x.first;
    long long m1(x.second);
    long long m2(rm[p]);
    mint tmp = tw.pow(m1) + tw.pow(m2) - 1;
    v.push_back(tmp);
  }
  for (auto x : lm) {
    pair<long long, long long> p = x.first;
    long long m1(x.second);
    long long m2(rp[p]);
    if (m2) continue;
    mint tmp = tw.pow(m1) + tw.pow(m2) - 1;
    v.push_back(tmp);
  }
  if (v.size() > 0) {
    mint tmp = 1;
    for (auto x : v) {
      tmp *= x;
    }
    ans += tmp;
  }
  ans -= 1;
  cout << (ans.x) << '\n';
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}
