#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<ll,ll>;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  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;
  }

  // for prime mod
  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;}

const int MAX_N = 200006;
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(MAX_N);


ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  int n; cin >> n;
  vector<P> v(0);
  int cz = 0;
  rep(i,n) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      cz++;
    } else {
      int sign = 1;
      if (a < 0 && b > 0) {
        a = -a; sign = -1;
      } else if (a > 0 && b < 0) {
        b = -b; sign = -1;
      }
      if (a == 0) {
        v.push_back(P(0, 1));
      } else if (b == 0) {
        v.push_back(P(-1, 0));
      } else {
        ll g = gcd(max(a,b), min(a,b));
        v.push_back(P(sign * a/g, b/g)); // P(大, 小)
      }
    }
  }

  sort(all(v));

  // cout << "a~~~~~~~~~" << endl;
  // for (P p : v) {
  //   cout << p.first << " " << p.second << endl;
  // }
  // cout << "b~~~~~~~~~" << endl;

  vector<P> s(0);
  int i = 0;
  int n_v = v.size();
  int t = n_v; // ペアのいないやつの合計
  while (i < n_v) {
    P p = v[i];
    ll a = p.first, b = p.second;

    P p2 = P(b, -a);
    int cnt2 = upper_bound(all(v), p2) - lower_bound(all(v), p2);
    int cnt = upper_bound(all(v), p) - lower_bound(all(v), p);

    if (a < 0 && cnt2 > 0) {
      s.push_back(P(cnt2, cnt));
      t -= cnt + cnt2;
      // cout << cnt2 << " " << cnt << endl;
    }

    i += cnt;
  }
  // cout << t << endl;

  mint pro = 0;
  rep (j, t+1) {
    pro += c(t, j);
  }
  // cout << "d " << pro << endl;

  for (P p : s) {
    mint sum = -1;
    ll a = p.first, b = p.second;
    rep(j, a+1) {
      sum += c(a, j);
    }
    rep(j, b+1) {
      sum += c(b, j);
    }
    // cout << "e " << sum << endl;
    pro *= sum;
  }
  // cout << "c~~~~~~~~~" << endl;

  cout << pro-1+cz << endl;
}


Measured memory_bytes: 10504