#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const int mx = 1000010;
const long long mod = 1e9 + 7;
vector<long long> inv, fact, invfact;
void mod_build(int n) {
  fact.resize(n + 1);
  inv.resize(n + 1);
  invfact.resize(n + 1);
  fact[0] = inv[0] = invfact[0] = 1;
  inv[1] = 1;
  for (int i = (int)(0); i < (int)(n); ++i) {
    fact[i + 1] = fact[i] * (i + 1) % mod;
    if (i > 0) inv[i + 1] = mod - inv[mod % (i + 1)] * (mod / (i + 1)) % mod;
    invfact[i + 1] = invfact[i] * inv[i + 1] % mod;
  }
}
long long perm(int n, int k) {
  if (n < 0 || k < 0 || k > n) {
    return 0;
  } else {
    return fact[n] * invfact[n - k] % mod;
  }
}
long long comb(int n, int k) {
  if (n < 0 || k < 0 || k > n) {
    return 0;
  } else {
    return (fact[n] * invfact[n - k] % mod) * invfact[k] % mod;
  }
}
long long modpow(long long x, long long n) {
  x %= mod;
  long long res = 1;
  while (n > 0) {
    if (n & 1) {
      res = res * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
long long modinv(long long a) { return modpow(a, mod - 2); }
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  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 {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long 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 {
    mint res(*this);
    return res /= a;
  }
};
int main() {
  int n;
  cin >> n;
  map<long double, int> mp;
  vector<long long> a(n), b(n);
  vector<long double> c(n);
  int az = 0;
  for (int i = (int)(0); i < (int)(n); ++i) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 && b[i] == 0) continue;
    if (a[i] == 0) {
      az++;
      continue;
    }
    c[i] = (long double)(b[i]) / (long double)(a[i]);
    mp[c[i]]++;
  }
  long long ori = 0;
  set<long double> st;
  vector<pair<int, int> > k;
  bool flag = false;
  for (int i = (int)(0); i < (int)(n); ++i) {
    if (a[i] == 0 && b[i] == 0) continue;
    if (c[i] == 0 || a[i] == 0) {
      if (mp.count(0) != 0 && az != 0) {
        if (!flag) {
          k.emplace_back(mp[0], az);
          flag = true;
        }
      } else {
        ori++;
      }
      continue;
    }
    long double d = (long double)(a[i]) / (long double)(b[i]) * -1;
    if (mp.count(d) == 0) {
      ori++;
    } else {
      if (st.find(d) == st.end()) {
        k.emplace_back(mp[c[i]], mp[d]);
        st.insert(c[i]);
        st.insert(d);
      }
    }
  }
  mint ans = modpow(2, ori);
  for (auto it : k) {
    mint tmp = modpow(2, it.first) + modpow(2, it.second) - 1;
    ans *= tmp;
  }
  ans -= 1;
  cout << ans.x << endl;
  return 0;
}
