#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
void print_container(T &container, string delim = " ") {
  bool first = true;
  for (auto &t : container) {
    if (!first) {
      cout << delim;
    }
    first = false;
    cout << t;
  }
  cout << endl;
}
const int MOD = 1e9 + 7;
const double EPS = 1e-8;
ll power(int n, int p) {
  if (p == 0) return 1;
  long long res = 1;
  long long add = n;
  while (p > 0) {
    if (p & 1) res = (res * add) % MOD;
    p >>= 1;
    add = add * add % MOD;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<ll> a(n), b(n);
  for (int((i)) = (0); ((i)) < ((n)); ((i))++) {
    cin >> a[i] >> b[i];
  }
  vector<pair<ll, ll>> data;
  ll a0 = 0, b0 = 0;
  for (int((i)) = (0); ((i)) < ((n)); ((i))++) {
    if (a[i] == 0 && b[i] == 0) {
      continue;
    } else if (a[i] == 0) {
      a0++;
    } else if (b[i] == 0) {
      b0++;
    } else {
      data.push_back({a[i], b[i]});
    }
  }
  int sz = data.size();
  map<double, pair<ll, ll>> dic;
  for (int((i)) = (0); ((i)) < ((sz)); ((i))++) {
    double val = (double)data[i].first / data[i].second;
    double key = abs(val);
    auto pos1 = dic.lower_bound(key - EPS);
    auto pos2 = dic.upper_bound(key + EPS);
    if (pos1 == pos2)
      dic[key] = {0, 0};
    else
      key = (*pos1).first;
    if (val > 0)
      dic[key].first++;
    else
      dic[key].second++;
  }
  ll ans = 1;
  for (auto p : dic) {
    double key = p.first;
    double target = 1.0 / key;
    auto pos1 = dic.lower_bound(target - EPS);
    auto pos2 = dic.upper_bound(target + EPS);
    if (pos1 == pos2) {
      ans = (ans * power(2, dic[key].first + dic[key].second)) % MOD;
      continue;
    }
    target = (*pos1).first;
    if (key > target) continue;
    ll tomul =
        (power(2, dic[key].first) + power(2, dic[target].second) - 1) % MOD;
    if (abs(key - 1) < EPS) {
      tomul = (tomul *
               (power(2, dic[key].second) + power(2, dic[target].first) - 1)) %
              MOD;
    }
    ans = (ans * tomul) % MOD;
  }
  ll tomul2 = (power(2, a0) + power(2, b0) - 1) % MOD;
  ans = (ans * tomul2) % MOD;
  cout << (ans + MOD - 1) % MOD << endl;
  return 0;
}
