#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> A(N), B(N);
  map<double, long long> mp1, mp2;
  long long a_0 = 0, b_0 = 0;
  long long ab_1 = 0;
  for (int i = 0; i < (N); i++) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 && B[i] == 0) {
      continue;
    }
    if (A[i] == 0) {
      ++a_0;
    } else if (B[i] == 0) {
      ++b_0;
    } else {
      ++ab_1;
      if (A[i] * B[i] > 0) {
        mp1[A[i] / B[i]]++;
      } else {
        mp2[-B[i] / A[i]]++;
      }
    }
  }
  vector<long long> l;
  l.push_back(modpow(2, a_0) + modpow(2, b_0) - 1);
  double a;
  long long b, c;
  for (auto v : mp1) {
    a = v.first;
    b = v.second;
    if (mp2.find(a) != mp2.end()) {
      c = mp2[a];
      ab_1 -= b;
      ab_1 -= c;
      l.push_back(modpow(2, b) + modpow(2, c) - 1);
    }
  }
  long long ans = 0;
  ans = modpow(2, ab_1);
  for (auto v : l) {
    ans *= v;
    ans %= MOD;
  }
  --ans;
  cout << ans << "\n";
  return 0;
}
