#include <bits/stdc++.h>
using namespace std;
long long p = 1e9 + 7;
long long gcd(long long m, long long n) {
  if (n == 0)
    return m;
  else
    return gcd(n, m % n);
}
long long lcm(long long m, long long n) { return m / gcd(m, n) * n; }
int main() {
  long long pow2[200001];
  pow2[0] = 1;
  for (long long i = (1); i < (200001); ++i) {
    pow2[i] = (pow2[i - 1] * 2) % p;
  }
  long long N;
  cin >> N;
  map<pair<long long, long long>, long long> m;
  for (long long i = (0); i < (N); ++i) {
    long long A, B;
    cin >> A >> B;
    long long K = gcd(A, B);
    A /= K;
    B /= K;
    if (A < 0) {
      A *= -1;
      B *= -1;
    } else if (A == 0)
      B = (B != 0 ? -1 : 0);
    m[make_pair(A, B)]++;
  }
  vector<pair<long long, long long> > v;
  for (auto e : m) {
    if (e.first.first > 0) {
      v.push_back(make_pair(e.second,
                            m[make_pair(e.first.second, e.first.first * -1)]));
    }
  }
  long long ans = 1;
  long long t = N;
  for (auto e : v) {
    if (e.second == 0) continue;
    t -= e.first + e.second;
    long long temp = pow2[e.first] + pow2[e.second] - 1;
    temp += p;
    temp %= p;
    ans *= temp;
    ans %= p;
  }
  if (m[make_pair(0, 0)] > 0) return 1;
  ans *= pow2[t];
  ans += p - 1;
  ans %= p;
  ans %= p;
  cout << ans << endl;
  return 0;
}
