#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1000000007;
long long power2(long long m) {
  long long res = 1;
  if (m > 0) {
    res = power2(m / 2);
    if (m & 1)
      res = (2 * ((res * res) % MOD)) % MOD;
    else
      res = (res * res) % MOD;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long N;
map<pair<long long, long long>, long long> M;
int main() {
  long long OO = 0;
  cin >> N;
  for (long long i = 0; i < N; i++) {
    long long A, B;
    cin >> A >> B;
    if (A == 0 && B == 0) {
      OO++;
      continue;
    }
    if (A == 0) {
      if (M.find(pair<long long, long long>(0, -1)) == M.end())
        M.insert(pair<pair<long long, long long>, long long>(
            pair<long long, long long>(0, -1), 1));
      else
        M[pair<long long, long long>(0, -1)]++;
      continue;
    }
    if (B == 0) {
      if (M.find(pair<long long, long long>(1, 0)) == M.end())
        M.insert(pair<pair<long long, long long>, long long>(
            pair<long long, long long>(1, 0), 1));
      else
        M[pair<long long, long long>(1, 0)]++;
      continue;
    }
    long long sgn = ((A > 0 && B > 0) || (A < 0 && B < 0) ? 1 : -1);
    long long g = gcd(abs(A), abs(B));
    long long a = abs(A) / g, b = abs(B) / g;
    if (M.find(pair<long long, long long>(a, sgn * b)) == M.end())
      M.insert(pair<pair<long long, long long>, long long>(
          pair<long long, long long>(a, sgn * b), 1));
    else
      M[pair<long long, long long>(a, sgn * b)]++;
  }
  long long ans = 1;
  while (!M.empty()) {
    pair<long long, long long> p = M.begin()->first;
    long long a = M.begin()->second;
    M.erase(p);
    long long s = p.first, t = p.second;
    long long sgn = (t >= 0 ? -1 : 1);
    long long b = 0;
    if (M.find(pair<long long, long long>(abs(t), sgn * abs(s))) != M.end()) {
      b = M[pair<long long, long long>(abs(t), sgn * abs(s))];
      M.erase(pair<long long, long long>(abs(t), sgn * abs(s)));
    }
    ans = (ans * ((power2(a) + power2(b) - 1) % MOD)) % MOD;
  }
  ans = (ans + OO - 1) % MOD;
  cout << ans << endl;
  return 0;
}
