#include <bits/stdc++.h>
using namespace std;
const uint64_t MOD = 1e+9 + 7;
uint64_t bin_pow(uint64_t x, uint64_t y) {
  if (y <= 1) {
    return (y == 0) ? 1 : (x % MOD);
  }
  uint64_t w = bin_pow(x, y >> 1);
  uint64_t z = (w * w) % MOD;
  if (y % 2 == 1) {
    z = (x * z) % MOD;
  }
  return z;
}
uint64_t gcd(int64_t a, int64_t b) {
  uint64_t n = min(a, b), m = max(a, b);
  return (n == 0) ? m : gcd(m % n, n);
}
struct Rational {
  int64_t p, q;
  uint64_t index;
  Rational(int64_t p = 0, int64_t q = 0, uint64_t index = -1)
      : p(p), q(q), index(index) {
    if (this->p < 0 && this->q < 0) {
      this->p *= -1;
      this->q *= -1;
    } else if (this->p > 0 && this->q < 0) {
      this->p *= -1;
      this->q *= -1;
    }
    int64_t t = gcd(abs(this->p), abs(this->q));
    this->p /= t;
    this->q /= t;
  }
  bool operator==(const Rational &rhs) const {
    return (p == rhs.p) && (q == rhs.q);
  }
  bool operator<(const Rational &rhs) const {
    return (p == rhs.p) ? (q < rhs.q) : (p < rhs.p);
  }
};
int main() {
  uint64_t N;
  cin >> N;
  vector<int64_t> A(N), B(N);
  for (uint64_t n = 0; n < N; ++n) {
    cin >> A[n] >> B[n];
  }
  uint64_t count_zero_vec = 0;
  multiset<Rational> P, Q;
  for (uint64_t n = 0; n < N; ++n) {
    if (A[n] == 0 && B[n] == 0) {
      ++count_zero_vec;
    } else {
      P.emplace(+A[n], B[n], n);
      Q.emplace(-B[n], A[n], n);
    }
  }
  map<Rational, pair<uint64_t, uint64_t>> counter;
  for (const Rational &p : P) {
    Rational q(-p.q, p.p);
    bool find_p = counter.find(p) == counter.end();
    bool find_q = counter.find(q) == counter.end();
    if (find_p && find_q) {
      counter[p] = make_pair(P.count(p), Q.count(p));
    }
  }
  uint64_t S = 1;
  for (auto p : counter) {
    uint64_t T = 0;
    auto calc_pow2_sub1 = [&](uint64_t x) {
      return (bin_pow(2, x) + (MOD - 1)) % MOD;
    };
    T = (T + calc_pow2_sub1(p.second.first)) % MOD;
    T = (T + calc_pow2_sub1(p.second.second)) % MOD;
    T = (T + 1) % MOD;
    S = (S * T) % MOD;
  }
  S = (S + count_zero_vec) % MOD;
  S = (S + (MOD - 1)) % MOD;
  cout << S << endl;
  return 0;
}
