#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Pll = pair<ll, ll>;
constexpr ll MOD = 1000000007;

ll modpow(ll a, ll n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret = ret * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return ret;
}

int main() {
  int N;
  cin >> N;
  map<Pll, Pll> mp;
  ll zero = 0;
  for (int i = 0; i < N; ++i) {
    ll l, r;
    cin >> l >> r;
    if (l < 0) {
      l = -l;
      r = -r;
    }
    if (l == 0 && r == 0) {
      zero++;
    } else {
      ll dv = abs(gcd(l, r));
      if (l == 0)
        mp[{0, 1}].first++;
      else if (r == 0)
        mp[{1, 0}].second++;
      else if (r >= 0)
        mp[{l / dv, r / dv}].first++;
      else
        mp[{-r / dv, l / dv}].second++;
    }
  }
  ll ans = 1;
  for (auto p : mp)
    ans = ans * (modpow(2, p.second.first) + modpow(2, p.second.second) - 1) %
          MOD;
  cout << ((ans + zero - 1 + MOD) % MOD) << endl;
  return 0;
}