#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<long long, long long>;
template <typename T = long long>
T in() {
  T a;
  cin >> a;
  return a;
}
struct mint {
  ll x;
  mint(ll x = 0) : x((x % 1000000007 + 1000000007) % 1000000007) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= 1000000007) x -= 1000000007;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += 1000000007 - a.x) >= 1000000007) x -= 1000000007;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= 1000000007;
    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(1000000007 - 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; }
signed main() {
  long long n = in();
  map<double, long long> divp, divn, div2p, div2n;
  for (long long i = 0; i < (n); ++i) {
    long long a, b;
    cin >> a >> b;
    if (a < 0 ^ b < 0) {
      ++divn[-a / b];
      ++div2n[-b / a];
    } else {
      ++divp[a / b];
      ++div2p[b / a];
    }
  }
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  mint ans = mint(2).pow(n) - 1;
  long long tmp = mint(2).pow(n - 2).x;
  for (auto& itr : divp) {
    ans -= itr.second * div2n[itr.first];
  }
  for (auto& itr : divn) {
    ans -= itr.second * div2p[itr.first];
  }
  cout << ans;
  cout << "\n";
  return 0;
}
