#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1e+9 + 7;
template <typename T>
T gcd(T a, T b) {
  if (b == 0)
    return a;
  else
    return gcd<T>(b, a % b);
}
template <typename T>
T pow_mod(T n, T p, T m) {
  if (p == 0) return 1;
  if (p % 2 == 1)
    return pow_mod<T>(n, p - 1, m) * n % m;
  else {
    T tmp = pow_mod<T>(n, p / 2, m) % m;
    return tmp * tmp % m;
  }
}
int main() {
  int N;
  cin >> N;
  map<pair<long long, long long>, pair<int, int>> P;
  int num_zeros = 0;
  for (int i = 0; i < (int)(N); ++i) {
    long long A, B;
    cin >> A >> B;
    if (A == 0 and B == 0) {
      ++num_zeros;
      continue;
    }
    if (B < 0) {
      A = -A;
      B = -B;
    }
    long long GCD = gcd<long long>(A, B);
    A /= GCD;
    B /= GCD;
    if (A == 0)
      P[make_pair(A, 1)].first++;
    else if (B == 0)
      P[make_pair(B, 1)].second++;
    else if (A > 0)
      P[make_pair(A, B)].first++;
    else
      P[make_pair(B, -A)].second++;
  }
  long long ans = 1;
  for (auto p : P) {
    int num_i = p.second.first;
    int num_j = p.second.second;
    long long num_pairs = pow_mod<long long>(2, num_i, MOD) +
                          pow_mod<long long>(2, num_j, MOD) - 1;
    ans *= num_pairs % MOD;
    ans %= MOD;
  }
  cout << (ans + num_zeros - 1 + MOD) % MOD << endl;
  return 0;
}
