#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <map>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

template <uint32_t Modulus>
class modular {
public:
  using value_type = uint32_t;
  using max_type = uint64_t;

  static constexpr value_type mod = Modulus;
  static constexpr value_type mod_min = 1;
  static constexpr value_type mod_max = 2147483647;
  static_assert(mod >= mod_min, "invalid mod :: too small");
  static_assert(mod <= mod_max, "invalid mod :: too big");

  template <class T>
  static constexpr value_type normalize(T value_) {
    if (value_ < 0) {
      value_ = -value_;
      value_ %= mod;
      if (value_ == 0) return 0;
      return mod - value_;
    }
    return value_ % mod;
  }

private:
  value_type value;

public:
  constexpr modular(): value(0) { }
  template <class T>
  explicit constexpr modular(T value_): value(normalize(value_)) { }
  template <class T>
  explicit constexpr operator T() { return static_cast<T>(value); }

  constexpr value_type operator () () const { return value; }
  constexpr modular operator - () const { return modular(mod - value); }
  constexpr modular operator ~ () const { return inverse(); }

  constexpr value_type &extract() { return value; }
  constexpr modular inverse() const { return power(mod - 2); }
  constexpr modular power(max_type exp) const {
    modular res(1), mult(*this);
    while (exp > 0) {
      if (exp & 1) res *= mult;
      mult *= mult;
      exp >>= 1;
    }
    return res;
  }

  constexpr modular operator + (const modular &rhs) const { return modular(*this) += rhs; }
  constexpr modular& operator += (const modular &rhs) { 
    if ((value += rhs.value) >= mod) value -= mod; 
    return *this; 
  }

  constexpr modular operator - (const modular &rhs) const { return modular(*this) -= rhs; }
  constexpr modular& operator -= (const modular &rhs) { 
    if ((value += mod - rhs.value) >= mod) value -= mod; 
    return *this; 
  }

  constexpr modular operator * (const modular &rhs) const { return modular(*this) *= rhs; }
  constexpr modular& operator *= (const modular &rhs) { 
    value = (max_type) value * rhs.value % mod;
    return *this;
  }

  constexpr modular operator / (const modular &rhs) const { return modular(*this) /= rhs; }
  constexpr modular& operator /= (const modular &rhs) { return (*this) *= rhs.inverse(); }

  constexpr bool zero() const { return value == 0; }
  constexpr bool operator == (const modular &rhs) const { return value == rhs.value; }
  constexpr bool operator != (const modular &rhs) const { return value != rhs.value; }
  friend std::ostream& operator << (std::ostream &stream, const modular &rhs) {
    return stream << rhs.value;
  }

};

using modint = modular<1000000007>;

int main() {
  int N;
  std::cin >> N;
  std::vector<int64_t> A(N), B(N);
  std::map<std::pair<int64_t, int64_t>, std::map<int, int>> map;
  auto orthan = [&](int64_t a, int64_t b) {
    if (b >= 0 && a > 0) return 0;
    if (a <= 0 && b > 0) return 1;
    if (a < 0 && b <= 0) return 2;
    if (a >= 0 && b < 0) return 3;
    return 4;
  };
  int no = 0;
  for (int i: range(0, N)) {
    std::cin >> A[i] >> B[i];
    auto g = std::gcd(A[i], B[i]);
    if (A[i] == 0 && B[i] == 0) {
      ++no;
      continue;
    }
    if (g != 0) {
      A[i] /= g;
      B[i] /= g;
    }
    else {
      if (A[i] > 0) A[i] = 1;
      if (A[i] < 0) A[i] = -1;
      if (B[i] > 0) B[i] = 1;
      if (B[i] < 0) B[i] = -1;
    }
    int t = orthan(A[i], B[i]);
    for (int k: range(0, t)) {
      auto na = B[i];
      auto nb = -A[i];
      A[i] = na;
      B[i] = nb;
    }
    map[std::make_pair(A[i], B[i])][t]++;
  }
  modint ans(1);
  for (auto &p: map) {
    auto &tmp = p.second;
    modint a = modint(2).power(tmp[0] + tmp[2]);
    modint b = modint(2).power(tmp[1] + tmp[3]);
    ans *= a + b - modint(1);
  }
  std::cout << ans + modint(no) - modint(1) << '\n';
  return 0;
}


Measured memory_bytes: 65744