#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
ll INF = 999999999999999;
double pi = 3.141592653589793238;
ll gcd(ll a, ll b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
pair<ll, ll> func(ll a, ll b) {
  for (ll i = 0; i < 10; ++i) {
    ll num = gcd(a, b);
    a /= num;
    b /= num;
  }
  pair<ll, ll> p;
  p = make_pair(a, b);
  return p;
}
int main() {
  ll n;
  cin >> n;
  vector<pair<ll, ll>> p(n);
  vector<double> ab(n);
  vector<double> ba(n);
  for (ull i = 0; i < (ull)n; ++i) {
    ll a, b;
    cin >> a >> b;
    pair<ll, ll> tmp = func(a, b);
    a = tmp.first;
    b = tmp.second;
    ab.at(i) = a / b;
    ba.at(i) = -(b / a);
  }
  vector<vector<ll>> bad_relation(n);
  for (ll i = 0; i < n - 1; ++i) {
    for (ll j = i + 1; j < n; ++j) {
      if (ab.at(i) == ba.at(j)) {
        bad_relation.at(i).push_back(j);
        bad_relation.at(j).push_back(i);
      }
      if (ba.at(i) == ab.at(j)) {
        bad_relation.at(i).push_back(j);
        bad_relation.at(j).push_back(i);
      }
    }
  }
  ll ans = 1;
  for (ll i = 0; i < n; ++i) {
    ll num = n - bad_relation.at(i).size();
    for (ll j = 0; j < n; ++i) {
      ans *= 2;
      ans %= 1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
