#include <bits/stdc++.h>
using ll = long long;
using p = std::pair<ll, ll>;
const ll MOD = 1000000007;
ll n;
ll euclidean_gcd(ll a, ll b) {
  if (a < b) return euclidean_gcd(b, a);
  ll r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}
int main() {
  std::cin >> n;
  std::vector<ll> a(n), b(n);
  std::map<p, ll> mp;
  std::vector<p> zero;
  for (int i = 0; i < n; i++) {
    std::cin >> a[i] >> b[i];
    if (a[i] == 0 || b[i] == 0) {
      zero.emplace_back(a[i], b[i]);
      continue;
    }
    ll g = euclidean_gcd(std::abs(a[i]), std::abs(b[i]));
    if (mp[std::make_pair(-b[i] / g, a[i] / g)] != 0 ||
        mp[std::make_pair(b[i] / g, -a[i] / g)] != 0) {
    } else {
      mp[std::make_pair(a[i] / g, b[i] / g)]++;
    }
  }
  ll cnt = 1;
  if (zero.size() != 0) {
    cnt *= zero.size();
  }
  for (auto m : mp) {
    cnt *= m.second;
    cnt %= MOD;
  }
  std::cout << cnt << std::endl;
  return 0;
}
