#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int N;
  cin >> N;
  map<pair<ll, ll>, ll> M;
  ll Z = 0;
  for (ll i = 0; i < (ll)(N); i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      Z++;
    else if (a == 0 || b == 0) {
      if (a == 0)
        b = 1;
      else
        a = 1;
      if (M.count(make_pair(a, b)))
        M[make_pair(a, b)]++;
      else
        M[make_pair(a, b)] = 1;
    } else {
      ll tmp = gcd(a, b);
      a /= tmp;
      b /= tmp;
      if (b < 0) {
        a *= -1;
        b *= -1;
      }
      if (M.count(make_pair(a, b)))
        M[make_pair(a, b)]++;
      else
        M[make_pair(a, b)] = 1;
    }
  }
  mint res = 1;
  set<pair<ll, ll>> seen;
  for (auto p : M) {
    ll a = p.first.first;
    ll b = p.first.second;
    ll c = p.second;
    if (seen.count({a, b})) continue;
    seen.insert({a, b});
    mint tmp = mint(2).pow(c) - 1;
    if (a * b == 0) {
      a *= -1;
      b *= -1;
    }
    if (M.count({b, -a})) {
      seen.insert({b, -a});
      ll tmp2 = M[{b, -a}];
      tmp += mint(2).pow(tmp2) - 1;
    }
    tmp += 1;
    res *= tmp;
  }
  res = res + Z;
  res = res - 1;
  cout << res << endl;
}
