#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 res = 1;
  while (n) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long modinv(long long a) { return modpow(a, mod - 2); }
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N), B(N);
  for (long long i = 0; i < (N); i++) cin >> A[i] >> B[i];
  map<double, int> M;
  map<double, int> M2;
  int inf = 0;
  for (long long i = 0; i < (N); i++) {
    if (B[i] != 0) {
      M[(double)A[i] / (double)B[i]]++;
    } else
      inf++;
  }
  for (long long i = 0; i < (N); i++) {
    M2[-(double)B[i] / (double)A[i]]++;
  }
  long long ans = 1;
  auto itr = M.begin();
  for (long long i = 0; i < (M.size()); i++) {
    double tmp = itr->first;
    long long tmp2 = itr->second;
    if (tmp == 0) {
      (ans *= (modpow(2, tmp2) + modpow(2, inf) - 1) % mod) %= mod;
    } else if (M2.find(tmp) != M2.end()) {
      if (tmp > 0) {
        int tmp3 = M2[tmp];
        (ans *= (modpow(2, tmp2) + modpow(2, tmp3) - 1) % mod) %= mod;
      }
    } else
      (ans *= modpow(2, tmp2)) %= mod;
    itr++;
  }
  cout << (ans + mod - 1) % mod << endl;
}
