#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) {
  if (b > a) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a / g * b;
}
ll rep_jijo(ll n, ll x) {
  if (x == 0) return 1;
  if (x % 2 == 0) {
    ll t = rep_jijo(n, x / 2);
    return t * t % 1000000007;
  }
  return n * rep_jijo(n, x - 1) % 1000000007;
}
int main() {
  int n;
  cin >> n;
  int tmp = n;
  vector<double> a(n);
  vector<double> b(n);
  vector<ll> ng(300000);
  map<double, int> mp;
  for (int i = 0; i < (int)(n); i++) cin >> a[i] >> b[i];
  int cnt_a = 0;
  int cnt_b = 0;
  for (int i = 0; i < (int)(n); i++) {
    if (a[i] == 0 && b[i] == 0)
      tmp--;
    else if (a[i] == 0)
      cnt_a++;
    else if (b[i] == 0)
      cnt_b++;
    else {
      mp[a[i] / b[i]]++;
      mp[-1 * (b[i] / a[i])]++;
    }
  }
  int len = 0;
  for (auto p : mp) {
    if (p.second > 1) {
      ng[len] = p.second;
      len++;
    }
  }
  tmp -= cnt_a;
  tmp -= cnt_b;
  ll ans = 1;
  for (int i = 0; i < (int)(len); i++) {
    tmp -= ng[i];
    ans *= ng[i];
    ans %= 1000000007;
  }
  ans *= cnt_a;
  ans %= 1000000007;
  ans *= cnt_b;
  ans %= 1000000007;
  ans = ans * rep_jijo(2, tmp);
  ans %= 1000000007;
  cout << ans << endl;
  return 0;
}
