#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;

template<long long mod>
class modint{
private:
  long long a;
public:
  constexpr modint(const long long x = 0) noexcept : a(x%mod) {}
  constexpr long long& value() noexcept { return a; }
  constexpr const long long& value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint& operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if(a >= mod) a -= mod;
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if(a < rhs.a) a += mod;
    a -= rhs.a;
    return *this;
  }
  constexpr modint& operator*=(const modint rhs) noexcept {
    a = a*rhs.a%mod;
    return *this;
  }
  constexpr modint& operator/=(modint rhs) noexcept {
    long long k = mod-2;
    while(k > 0){
      if(k&1){
        *this *= rhs;
      }
      rhs *= rhs;
      k /= 2;
    }
    return *this;
  }
  friend ostream& operator<<(ostream &os, const modint &X){
    return os << X.a;
  }
  friend istream& operator>>(istream &is, modint &X){
    is >> X.a;
    X.a %= mod;
    if(X.a < 0) X.a += mod;
    return is;
  }
};

template<typename T>
T power(T x, long long k){
  T ret{1};
  while(k > 0){
    if(k&1) ret *= x;
    x *= x;
    k /= 2;
  }
  return ret;
}

int main(){
  using mint = modint<(int)1e9+7>;
  int N;
  cin >> N;
  using ll = long long;
  map<pair<ll,ll>,ll> M;
  set<pair<ll,ll>> S;
  int z = 0;
  for(int i = 0; i < N; ++i){
    ll a, b;
    cin >> a >> b;
    if(a == 0 and b == 0){
      ++z;
      continue;
    }
    ll g = abs(__gcd(a,b));
    a /= g, b /= g;
    ++M[{a,b}];
    S.emplace(abs(a),abs(b));
    S.emplace(abs(b),abs(a));
  }
  // for(auto e : M)
  //   cerr << "(" << e.first.first << ", " << e.first.second << ") -> " << e.second << endl;

  mint ans = 1;

  auto f = [](pair<ll,ll> a) -> pair<ll,ll> {
             return {a.second,a.first*-1};
           };

  for(auto e : S){
    long long c[2] = {};
    vector<pair<ll,ll>> D(1,e);
    for(int i = 0; i < 3; ++i)
      D.push_back(f(D[i]));
    // for(auto e : D){
    //   cerr << e.first << " " << e.second << endl;
    // }
    for(int i = 0; i < 4; ++i)
      c[i%2] += M[D[i]];
    ans *= power<mint>(2,c[0]) + power<mint>(2,c[1]) - 1;
    // cerr << power<mint>(2,c[0]) + power<mint>(2,c[1]) - 1 << endl;
    // cerr << ans << endl;
  }
  ans *= z+1;
  ans -= 1;
  cout << ans << endl;
}
