#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
const ll MOD{1000000007};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll fast_exp(ll a, ll n) {
  ll res = 1, base = a;
  while (n) {
    if (n & 1) res = (res * base) % MOD;
    base = (base * base) % MOD;
    n >>= 1;
  }
  return res;
}
ll solve(int N, const vector<ii>& xs) {
  map<ii, vector<int>> ab, ba;
  set<int> ys;
  for (int i = 0; i < N; ++i) {
    auto a = xs[i].first, b = xs[i].second;
    if (a == 0 and b == 0) continue;
    auto sa = a < 0 ? -1 : 1;
    auto sb = b < 0 ? -1 : 1;
    auto signal = sa * sb;
    a = llabs(a);
    b = llabs(b);
    auto d = gcd(a, b);
    a /= d;
    b /= d;
    ab[ii(signal * a, b)].push_back(i);
    ba[ii(-signal * b, a)].push_back(i);
    ys.insert(i);
  }
  ll ans = 1;
  for (auto p : ab) {
    if (ys.count(p.second.back()) == 0) continue;
    auto it = ba.find(p.first);
    if (it == ba.end()) {
      ans = (ans * fast_exp(2, p.second.size())) % MOD;
      for (auto x : p.second) ys.erase(x);
    } else {
      ll r = fast_exp(2, p.second.size());
      ll s = fast_exp(2, it->second.size());
      ll t = ((((r + s - 1) % MOD) + MOD) % MOD);
      ans = (ans * t) % MOD;
      for (auto x : p.second) ys.erase(x);
      for (auto x : it->second) ys.erase(x);
    }
  }
  return ((((ans - 1) % MOD) + MOD) % MOD);
}
int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<ii> xs(N);
  for (int i = 0; i < N; ++i) cin >> xs[i].first >> xs[i].second;
  auto ans = solve(N, xs);
  cout << ans << '\n';
  return 0;
}
