#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long modinv(long long a, long long mod) { return modpow(a, mod - 2, mod); }
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  COMinit();
  long long N;
  cin >> N;
  vector<pair<long long, long long>> P(N);
  long long lz = 0;
  long long rz = 0;
  long long z = 0;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    long long aa = abs(a), ab = abs(b);
    long long GCD = gcd(aa, ab);
    a /= GCD, b /= GCD;
    P[i] = make_pair(a, b);
    if (a == 0 && b == 0)
      z++;
    else if (a == 0)
      lz++;
    else if (b == 0)
      rz++;
  }
  map<pair<long long, long long>, long long> M;
  for (auto p : P) {
    M[p]++;
  }
  long long ans = 1;
  ans *= pow(2, lz) + pow(2, rz) - 1;
  for (auto m : M) {
    auto p = m.first;
    long long n = M[p];
    if (n == 0) continue;
    long long n_ = 0;
    auto p_ = p;
    p_.second *= -1;
    long long temp;
    temp = p_.first, p_.first = p_.second, p_.second = temp;
    if (M.find(p_) != M.end()) {
      n_ += M[p_];
      M[p_] = 0;
    }
    p_ = p;
    p_.first *= -1;
    temp = p_.first, p_.first = p_.second, p_.second = temp;
    if (M.find(p_) != M.end()) {
      n_ += M[p_];
      M[p_] = 0;
    }
    if (n_ != 0) {
      ans *= pow(2, n) + pow(2, n_) - 1;
      ans %= MOD;
    } else {
      ans *= pow(2, n);
      ans %= MOD;
    }
  }
  ans += z;
  ans -= 1;
  cout << ans << endl;
}
