#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);
ll power(ll x, ll y) {
  ll ans = 1;
  while (y) {
    if (y & 1) ans = (ans * x) % MOD;
    x = (x * x) % MOD;
    y >>= 1;
  }
  return ans;
}
int main(void) {
  ll n;
  cin >> n;
  vector<double> a(n), b(n);
  map<double, ll> m;
  ll ans = 1;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 || b[i] == 0) {
      m[0]++;
    } else {
      m[a[i] / b[i]]++;
    }
  }
  set<double> s;
  for (auto p : m) {
    if (s.find(p.first) != s.end()) {
      continue;
    }
    if (p.first != 0) {
      s.insert(p.first);
      s.insert(-1 / p.first);
    }
    ll x = m[p.first], y = m[-1 / p.first];
    if (p.first == 0) {
      ans *= (m[0] + 1);
      ans %= MOD;
    } else if (y == 0) {
      ans *= power(2, x);
      ans %= MOD;
    } else {
      ans *= (power(2, x) + power(2, y) - 1);
      ans %= MOD;
    }
  }
  ans = (ans - 1 + MOD) % MOD;
  cout << ans << endl;
}
