#include <bits/stdc++.h>
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
constexpr long long INF = INT_MAX / 2;
constexpr long long LINF = LLONG_MAX / 2;
constexpr double eps = 1e-9;
template <class T>
class prique : public std::priority_queue<T, std::vector<T>, std::greater<T>> {
};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return 1;
  }
  return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return 1;
  }
  return 0;
}
inline long long gcd(long long a, long long b) {
  while (b) {
    long long c = a;
    a = b;
    b = c % b;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
bool isprime(long long n) {
  if (n == 1) return false;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
long long mypow(long long a, long long b) {
  if (!b) return 1;
  if (b & 1) return mypow(a, b - 1) * a;
  long long memo = mypow(a, b >> 1);
  return memo * memo;
}
long long modpow(long long a, long long b, long long m) {
  if (!b) return 1;
  if (b & 1) return modpow(a, b - 1, m) * a % m;
  long long memo = modpow(a, b >> 1, m);
  return memo * memo % m;
}
template <typename T>
void printArray(std::vector<T>& vec) {
  for (long long i = 0; i < (long long)(vec.size() - 1); i++)
    std::cout << vec[i] << " ";
  std::cout << vec.back() << std::endl;
}
template <typename T>
void printArray(T l, T r) {
  T rprev = r;
  rprev--;
  for (T i = l; i != rprev; i++) {
    std::cout << *i << " ";
  }
  std::cout << *rprev << std::endl;
}
std::string to_string(std::vector<long long>& vec) {
  std::string res = "[";
  for (long long i = 0; i < (long long)(vec.size() - 1); i++)
    res += std::to_string(vec[i]) + ", ";
  res += std::to_string(vec.back()) + "]";
  return res;
}
class Rational {
 public:
  long long num, den;
  Rational() : num(0), den(1) {}
  Rational(long long p) : num(p), den(1) {}
  Rational(long long p, long long q) : num(p), den(q) { reduce(); }
  void reduce() {
    if (den < 0) {
      num = -num;
      den = -den;
    }
    if (num == 0)
      den = 1;
    else {
      long long r = gcd(abs(num), abs(den));
      num /= r;
      den /= r;
    }
  }
  inline bool operator<(const Rational& rhs) const {
    return num * rhs.den < rhs.num * den;
  }
  inline bool operator==(const Rational& rhs) const {
    return num * rhs.den == rhs.num * den;
  }
  inline bool operator>(const Rational& rhs) const {
    return num * rhs.den > rhs.num * den;
  }
  inline Rational& operator+=(Rational rhs) {
    long long r = lcm(this->den, rhs.den);
    num *= r / this->den;
    rhs.num *= r / rhs.den;
    den = rhs.den = r;
    num += rhs.num;
    reduce();
    return *this;
  }
  inline Rational operator-() { return Rational(-num, den); }
  inline Rational& operator-=(Rational rhs) {
    long long r = lcm(this->den, rhs.den);
    num *= r / this->den;
    rhs.num *= r / rhs.den;
    den = rhs.den = r;
    num -= rhs.num;
    reduce();
    return *this;
  }
  inline Rational& operator*=(const Rational& rhs) {
    num *= rhs.num;
    den *= rhs.den;
    reduce();
    return *this;
  }
  inline Rational& operator/=(const Rational& rhs) {
    num *= rhs.den;
    den *= rhs.num;
    reduce();
    return *this;
  }
  template <typename T>
  Rational operator+(const T& rhs) const {
    return Rational(*this) += rhs;
  }
  template <typename T>
  Rational& operator+=(const T& rhs) {
    return operator+=(Rational(rhs));
  }
  template <typename T>
  Rational operator-(const T& rhs) const {
    return Rational(*this) -= rhs;
  }
  template <typename T>
  Rational& operator-=(const T& rhs) {
    return operator-=(Rational(rhs));
  }
  template <typename T>
  Rational operator*(const T& rhs) const {
    return Rational(*this) *= rhs;
  }
  template <typename T>
  Rational& operator*=(const T& rhs) {
    return operator*=(Rational(rhs));
  }
  template <typename T>
  Rational operator/(const T& rhs) const {
    return Rational(*this) /= rhs;
  }
  template <typename T>
  Rational& operator/=(const T& rhs) {
    return operator/=(Rational(rhs));
  }
  Rational inv() const { return Rational(den, num); }
};
std::ostream& operator<<(std::ostream& ofs, const Rational& x) {
  ofs << x.num << "/" << x.den;
  return ofs;
}
template <unsigned long long modulo = 1000000007>
class ModInt {
  long long value;

 public:
  ModInt() : value(0) {}
  template <typename T>
  ModInt(T value = 0) : value(value) {
    if (value < 0) value = -(long long)(-value % modulo) + modulo;
    this->value = value % modulo;
  }
  inline operator long long() const { return value; }
  inline ModInt& operator+=(const ModInt& x) {
    value += x.value;
    if (value >= modulo) value -= modulo;
    return *this;
  }
  inline ModInt& operator++() {
    if (value == modulo - 1)
      value = 0;
    else
      value++;
    return *this;
  }
  inline ModInt operator-() const { return ModInt(0) -= *this; }
  inline ModInt& operator-=(const ModInt& x) {
    value -= x.value;
    if (value < 0) value += modulo;
    return *this;
  }
  inline ModInt& operator--() {
    if (value == 0)
      value = modulo - 1;
    else
      value--;
    return *this;
  }
  inline ModInt& operator*=(const ModInt& x) {
    value = value * x.value % modulo;
    return *this;
  }
  inline ModInt& operator/=(ModInt rhs) {
    long long exp = modulo - 2;
    while (exp) {
      if (exp & 1) *this *= rhs;
      rhs *= rhs;
      exp >>= 1;
    }
    return *this;
  }
  template <typename T>
  ModInt operator+(const T& rhs) const {
    return ModInt(*this) += rhs;
  }
  template <typename T>
  ModInt& operator+=(const T& rhs) {
    return operator+=(ModInt(rhs));
  }
  template <typename T>
  ModInt operator-(const T& rhs) const {
    return ModInt(*this) -= rhs;
  }
  template <typename T>
  ModInt& operator-=(const T& rhs) {
    return operator-=(ModInt(rhs));
  }
  template <typename T>
  ModInt operator*(const T& rhs) const {
    return ModInt(*this) *= rhs;
  }
  template <typename T>
  ModInt& operator*=(const T& rhs) {
    return operator*=(ModInt(rhs));
  }
  template <typename T>
  ModInt operator/(const T& rhs) const {
    return ModInt(*this) /= rhs;
  }
  template <typename T>
  ModInt& operator/=(const T& rhs) {
    return operator/=(ModInt(rhs));
  }
};
template <unsigned long long T>
std::istream& operator>>(std::istream& ist, ModInt<T>& x) {
  long long a;
  ist >> a;
  x = a;
  return ist;
}
long long n;
long long a0, b0, both0;
std::map<Rational, long long> mp;
std::set<Rational> d;
signed main() {
  std::cin >> n;
  for (long long i = 0; i < (long long)(n); i++) {
    long long a, b;
    std::cin >> a >> b;
    if (a == 0 && b == 0)
      both0++;
    else if (a == 0)
      a0++;
    else if (b == 0)
      b0++;
    else
      mp[Rational(a, b)]++;
  }
  long long ans = 1;
  for (auto ite = mp.begin(); ite != mp.end(); ite++) {
    if (d.find((*ite).first) != d.end()) continue;
    if (mp.find(-(*ite).first.inv()) == mp.end()) {
      ans *= modpow(2, (*ite).second, 1000000007);
      ans %= 1000000007;
    } else {
      ans *= (modpow(2, (*ite).second, 1000000007) +
              modpow(2, mp[-((*ite).first.inv())], 1000000007) - 1);
      ans %= 1000000007;
      d.insert(-((*ite).first.inv()));
    }
  }
  ans *= modpow(2, a0, 1000000007) + modpow(2, b0, 1000000007) - 1;
  ans %= 1000000007;
  ans += both0 - 1;
  if (ans < 0) ans += 1000000007;
  ans %= 1000000007;
  std::cout << ans << std::endl;
  return 0;
}
