#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
ll mod = 1000000007;
ll gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll modpow(ll a, ll b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return res;
}
int main() {
  ll n;
  cin >> n;
  set<pll> s;
  map<pll, ll> m;
  pll ins;
  ll C = 0;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      C++;
      continue;
    }
    if (a == 0) {
      b = 1;
    }
    if (b == 0) {
      a = 1;
    }
    ll g = gcd(a, b);
    a /= g;
    b /= g;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    ins.first = a;
    ins.second = b;
    s.insert(ins);
    m[ins]++;
  }
  set<pll> t;
  ll ans = 1;
  for (auto p : m) {
    ll a = p.first.first;
    ll b = p.first.second;
    ins.first = a;
    ins.second = b;
    if (t.count(ins)) continue;
    ll sub = modpow(2, p.second) - 1;
    ll c, d;
    if (a == 0 && b == 1) {
      c = 1;
      d = 0;
    }
    if (a == 1 && b == 0) {
      c = 0;
      d = 1;
    }
    if (a != 0 && b != 0) {
      c = b;
      d = -a;
      if (c < 0) {
        c *= -1;
        d *= -1;
      }
    }
    ins.first = c;
    ins.second = d;
    if (s.count(ins)) {
      sub += modpow(2, m[ins]) - 1;
      t.insert(ins);
    }
    sub %= mod;
    sub++;
    sub %= mod;
    ans = ans * sub % mod;
  }
  ans = (ans + C - 1) % mod;
  cout << ans << endl;
}
