#include <bits/stdc++.h>
using namespace std;
int64_t GCD(int64_t A, int64_t B) {
  int64_t mA = max(A, B);
  int64_t mB = min(A, B);
  if (mA % mB == 0) {
    return mB;
  } else {
    return GCD(mA % mB, mB);
  }
}
int64_t pow2(int64_t i) {
  int64_t k = 1;
  for (int j = 0; j < i; j++) {
    k *= 2;
    k %= 1000000007;
  }
  return k;
}
int main() {
  int64_t N;
  cin >> N;
  map<pair<int64_t, int64_t>, int64_t> M;
  set<pair<int64_t, int64_t>> S;
  int64_t A, B;
  int64_t dzero = 0, zero1 = 0, zero2 = 0;
  for (int i = 0; i < N; i++) {
    cin >> A >> B;
    if (A == 0 && B == 0) {
      dzero++;
    } else if (A == 0) {
      zero1++;
    } else if (B == 0) {
      zero2++;
    } else {
      if (A < 0) {
        A *= -1;
        B *= -1;
      }
      int64_t D = GCD(abs(A), abs(B));
      pair<int64_t, int64_t> P = make_pair(A / D, B / D);
      M[P]++;
      S.insert(P);
    }
  }
  int64_t Ans = 1;
  for (pair<int64_t, int64_t> Q : S) {
    if (M[Q] != 0) {
      int64_t r = M[Q];
      pair<int64_t, int64_t> J;
      if (Q.second > 0) {
        J = make_pair(Q.second, -Q.first);
      } else {
        J = make_pair(-Q.second, Q.first);
      }
      int64_t s = 0;
      if (M[J] > 0) {
        s = M[J];
        M.erase(J);
      }
      Ans *= (pow2(r) % 1000000007 + pow2(s) % 1000000007 - 1) % 1000000007;
      Ans %= 1000000007;
    }
  }
  Ans *= (pow2(zero1) % 1000000007 + pow2(zero2) % 1000000007 - 1) % 1000000007;
  Ans %= 1000000007;
  Ans += dzero % 1000000007 - 1;
  cout << Ans << endl;
}
