#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <numeric>

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

#define in(v) v; cin >> v;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

// debug
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif

template<int MOD> struct MInt {
  long long val;
  constexpr MInt(long long val = 0) : val(val % MOD) { if (val < 0) val += MOD; }
  MInt operator-() const { return MInt(-val); }
  MInt operator+(const MInt& n) const { return MInt(val) += n; }
  MInt operator-(const MInt& n) const { return MInt(val) -= n; }
  MInt operator*(const MInt& n) const { return MInt(val) *= n; }
  MInt operator/(const MInt& n) const { return MInt(val) /= n; }
  MInt& operator+=(const MInt& n) { val = (val + n.val) % MOD; return *this; }
  MInt& operator-=(const MInt& n) { val = (MOD + val - n.val) % MOD; return *this; }
  MInt& operator*=(const MInt& n) { val = (val * n.val) % MOD; return *this; }
  MInt& operator/=(const MInt& n) { val = (*this * n.inv()).val; return *this; }
  bool operator==(const MInt& n) { return val == n.val; }
  bool operator!=(const MInt& n) { return val != n.val; }
  MInt pow(long long n) const {
    MInt pow = val, ans = 1;
    for (long long p = n; p > 0; p >>= 1, pow *= pow)
      if (p & 1) ans *= pow;
    return ans;
  }
  MInt inv() const { return pow(MOD-2); }
  friend ostream& operator<<(ostream& os, const MInt& n) { os<<n.val; return os; }
  friend istream& operator>>(istream& os, MInt& n) { os>>n.val; return os; }
};
constexpr int MOD = 1e9+7;
constexpr double eps = 1e-10;
// constexpr int MOD = 998244353;
using mint = MInt<MOD>;

int main() {
  int in(N);

  vector<pair<ll, ll>> v;
  int zeros = 0;
  vector<ll> A(N), B(N);
  rep(i, N) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 && B[i] == 0)
      ++zeros;
    else {
      ll g = gcd(A[i], B[i]);
      A[i] /= g;
      B[i] /= g;
      if (B[i] < 0) {
        A[i] *= -1;
        B[i] *= -1;
      }
      if (A[i] == -1 && B[i] == 0)
        A[i] = 1;
      v.emplace_back(A[i], B[i]);
    }
  }
  all(sort, v);

  int count = 0; // ペアに含まれているやつ
  mint X = 1;
  rep(i, v.size()) {
    auto [a, b] = v[i];
    int countV = upper_bound(v.begin(), v.end(), v[i]) - lower_bound(v.begin(), v.end(),  v[i]);
    int tmp = 0;
    auto p = make_pair(b, -a);
    tmp += upper_bound(v.begin()+i+1, v.end(),  p) - lower_bound(v.begin()+i+1, v.end(),  p);
    if (tmp > 0) {
      count += countV + tmp;
      X *= (mint(2).pow(countV)) + (mint(2).pow(tmp)) - 2 + 1;
    }
    i += countV-1;
  }

  debug(v);
  debug(X);

  mint ans = mint(2).pow(N-zeros-count) * X - 1;
  cout << ans + zeros << endl;

  return 0;
}



Measured memory_bytes: 10512