#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  double A[200001], B[200001];
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> A[i] >> B[i];
  vector<double> C, D;
  for (long long i = 0; i < n; i++)
    if (A[i] && B[i]) C.push_back(A[i] / B[i]), D.push_back(-B[i] / A[i]);
  sort(C.begin(), C.end());
  sort(D.begin(), D.end());
  long long mod = 1e9 + 7, a = 0, z = 0;
  vector<pair<long long, long long> > E;
  double c;
  if (C.size() > 0) c = C[0];
  for (long long i = 0; i < C.size(); i++) {
    if (z) continue;
    if (C[i] > 0) z = 1;
    if (c == C[i]) a++;
    if (c != C[i] || z) {
      long long b = upper_bound(D.begin(), D.end(), c) -
                    lower_bound(D.begin(), D.end(), c);
      if (b) E.push_back(pair<long long, long long>(a, b));
      a = 1;
      c = C[i];
    }
  }
  long long X = 0, Y = 0, Z = 0;
  for (long long i = 0; i < n; i++) {
    if (!A[i] && B[i]) X++;
    if (A[i] && !B[i]) Y++;
    if (!A[i] && !B[i]) Z++;
  }
  if (X && Y) E.push_back(pair<long long, long long>(X, Y));
  long long sum = 0;
  for (auto i : E) {
    sum += i.first + i.second;
  }
  vector<long long> F(n + 1, 1);
  for (long long i = 0; i < n; i++) F[i + 1] = F[i] * 2 % mod;
  long long ans = F[n - Z - sum];
  for (auto i : E) {
    ans = ans * ((F[i.first] + F[i.second] - 1 + mod) % mod) % mod;
  }
  cout << (ans + Z - 1 + mod) % mod << "\n";
}
