#include <bits/stdc++.h>
std::vector<int> groupP[200005], groupM[200005];
long long power2[200005];
long long mod = 1e9 + 7;
void init() {
  power2[0] = 1;
  for (int i = 1; i < 200005; i++) {
    power2[i] = power2[i - 1] * 2;
    power2[i] %= mod;
  }
  return;
}
int main() {
  int N;
  scanf("%d", &N);
  std::vector<long long> A(N), B(N);
  std::vector<std::pair<long double, int> > ratioP, ratioM, ratioA0, ratioB0,
      ratioAB0;
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
    scanf("%lld", &B[i]);
    if (A[i] == 0 && B[i] == 0) {
      ratioAB0.push_back(std::make_pair(0.0, i));
    } else if (A[i] == 0) {
      ratioA0.push_back(std::make_pair(0.0, i));
    } else if (B[i] == 0) {
      ratioB0.push_back(std::make_pair(0.0, i));
    } else if ((A[i] > 0 && B[i] > 0) || (A[i] < 0 && B[i] < 0)) {
      ratioP.push_back(std::make_pair((long double)A[i] / B[i], i));
    } else {
      ratioM.push_back(std::make_pair((long double)A[i] / B[i], i));
    }
  }
  init();
  std::sort(ratioP.begin(), ratioP.end());
  std::sort(ratioM.begin(), ratioM.end());
  int indexP = 0;
  int indexM = 0;
  int vectorP = 0, vectorM = 0;
  double setP = -9999999999;
  double setM = 9999999999;
  while (indexP < ratioP.size() && indexM < ratioM.size()) {
    long double dP = ratioP[indexP].first;
    long double dM = ratioM[indexM].first;
    long double multiple = (double)dP * (-dM);
    if (abs(1 - multiple) < 1e-10) {
      groupP[vectorP].push_back(indexP);
      groupM[vectorM].push_back(indexM);
      long double dP_save = dP;
      indexP++;
      while (indexP < ratioP.size() &&
             abs(ratioP[indexP].first - dP_save) < 1e-10) {
        groupP[vectorP].push_back(indexP);
        indexP++;
      }
      long double dM_save = dM;
      indexM++;
      while (indexM < ratioM.size() &&
             abs(ratioM[indexM].first - dM_save) < 1e-10) {
        groupM[vectorM].push_back(indexM);
        indexM++;
      }
      vectorP++;
      vectorM++;
    } else if (multiple > 1.0) {
      indexM++;
    } else if (multiple < 1.0) {
      indexP++;
    }
  }
  int paircount = 0;
  long long ans = 1;
  for (int i = 0; i < vectorP; i++) {
    paircount += groupP[i].size();
    paircount += groupM[i].size();
    ans *= (power2[groupP[i].size()] + power2[groupM[i].size()] - 1);
    if (ans > mod)
      ans %= mod;
    else if (ans < 0)
      ans += mod;
  }
  ans *= power2[ratioA0.size()] + power2[ratioB0.size()] - 1;
  if (ans > mod)
    ans %= mod;
  else if (ans < 0)
    ans += mod;
  int nonpaircount =
      N - paircount - ratioA0.size() - ratioB0.size() - ratioAB0.size();
  ans *= power2[nonpaircount];
  ans %= mod;
  ans--;
  if (ans < 0) ans += mod;
  std::cout << ans << std::endl;
  return 0;
}
