#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

template<int MOD>
struct ModInt {
  ll x;
  ModInt():x(0){}
  ModInt(ll x):x((x%MOD+MOD)%MOD){}
  int getMod() { return MOD; }
  ModInt operator-() const { return ModInt(0) - *this;}
  ModInt& operator+=(const ModInt& a){ if((x+=a.x)>=MOD) x-=MOD; return *this;}
  ModInt& operator-=(const ModInt& a){ if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
  ModInt& operator*=(const ModInt& a){ (x*=a.x)%=MOD; return *this;}
  ModInt operator+(const ModInt& a)const{ return ModInt(*this) += a;}
  ModInt operator-(const ModInt& a)const{ return ModInt(*this) -= a;}
  ModInt operator*(const ModInt& a)const{ return ModInt(*this) *= a;}
  bool operator<(const ModInt& a)const{ return x < a.x;}
  bool operator==(const ModInt& a)const{ return x == a.x;}
  ModInt pow(ll t) const {
    if (!t) return 1;
    ModInt a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  friend istream & operator >> (istream & in, ModInt & v) {
    ll x;
    in >> x;
    v.x = x;
    return in;
  }
  friend ostream & operator << (ostream & out, ModInt<MOD> const & v) {
    out << v.x;
    return out;
  }
};
const int MOD = 1000000007;
using mint = ModInt<MOD>;

typedef pair<ll, ll> P;

int main() {
  int n; cin >> n;
  map<P, int> M;
  int zero2 = 0, a_zero = 0, b_zero = 0;
  loop(i,0,n) {
    ll a, b; cin >> a >> b;
    if (a == 0 and b == 0) {
      M[make_pair(0, 0)]++;
      continue;
    }

    if (a == 0) {
      M[make_pair(0, 1)]++;
      continue;
    }

    if (b == 0) {
      M[make_pair(1, 0)]++;
      continue;
    }

    ll gc = __gcd(abs(a), abs(b));
    a /= gc, b /= gc;
    if (b < 0) a *= -1, b *= -1;
    M[make_pair(a, b)]++;
  }

  mint ans = mint(2).pow(M[make_pair(0, 1)]) + mint(2).pow(M[make_pair(1, 0)]) - 1;
  set<P> S;
  for (auto &&m: M) {
    if (m.first.first == 0 and m.first.second == 0) continue;
    if (S.count(m.first)) continue;
    ll count = m.second;
    ll a = m.first.first, b = m.first.second;
    ll a2 = -b, b2 = a;
    if (b2 < 0) a2 *= -1, b2 *= -1;
    ll count2 = M[make_pair(a2, b2)];
    if (count2 > 0) {
      ans *= mint(2).pow(count) + mint(2).pow(count2) - mint(1);
    } else {
      ans *= mint(2).pow(count);
    }
    S.insert(make_pair(a2, b2));
  }

  ans += M[make_pair(0, 0)];
  ans -= 1;
  cout << ans << endl;
  return 0;
}
