#include <bits/stdc++.h>
using namespace std;
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;
}
int main() {
  int N;
  cin >> N;
  vector<double> A(N), B(N);
  for (int i = 0; i < (int)(N); i++) cin >> A[i] >> B[i];
  map<double, long long> check1, check2;
  int zero = 0;
  vector<double> memo;
  for (int i = 0; i < (int)(N); i++) {
    if (B[i]) {
      if (check1[A[i] / B[i]] <= 0) memo.push_back(A[i] / B[i]);
      check1[A[i] / B[i]]++;
    }
    if (A[i]) {
      check2[-B[i] / A[i]]++;
    }
    if (A[i] == 0 || B[i] == 0) zero++;
  }
  long long cnt = 0;
  long long ans = 1;
  for (int i = 0; i < (int)(memo.size()); i++) {
    if (memo[i] == 0) {
      ans *= modpow(2, zero - 1, 1000000007);
      ans %= 1000000007;
      cnt += zero;
      continue;
    }
    if (check2[memo[i]] > 0) {
      cnt += check1[memo[i]] + check2[memo[i]];
      ans *= (modpow(2, check1[memo[i]], 1000000007) - 1);
      ans %= 1000000007;
    }
  }
  ans *= modpow(2, N - cnt, 1000000007);
  ans %= 1000000007;
  cout << ans << endl;
}
