#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}
long long inv[1000010 + 10], fac[1000010 + 10], ifac[1000010 + 10];
void setComb() {
  inv[0] = 1;
  inv[1] = 1;
  fac[1] = 1;
  ifac[1] = 1;
  fac[0] = 1;
  ifac[0] = 1;
  for (int i = 2; i < 1000010; i++) {
    inv[i] = (-MOD / i) * inv[MOD % i] % MOD;
    fac[i] = fac[i - 1] * i % MOD;
    ifac[i] = ifac[i - 1] * inv[i] % MOD;
    inv[i] = (inv[i] + MOD) % MOD;
    fac[i] = (fac[i] + MOD) % MOD;
    ifac[i] = (ifac[i] + MOD) % MOD;
  }
  return;
}
long long comb(long long n, long long k) {
  if (n < k || n < 0 || k < 0)
    return 0;
  else
    return ((fac[n] * ifac[k] % MOD * ifac[n - k] % MOD + MOD) % MOD);
}
long long hcomb(long long n, long long r) {
  if (n == 0 && r == 0)
    return 1;
  else if (n < 0 || r < 0)
    return 0;
  else
    return comb(n + r - 1, r);
}
long long mod_pow(long long x, long long n) {
  x %= MOD;
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
void add(long long &a, long long b) { a = (a + b) % MOD; }
void mul(long long &a, long long b) {
  a %= MOD;
  b %= MOD;
  a = a * b % MOD;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  for (int i = 0; i < (N); ++i) cin >> A[i] >> B[i];
  setComb();
  vector<pair<long long, long long>> v(N);
  map<pair<long long, long long>, long long> mp;
  long long azero = 0, bzero = 0, zero = 0;
  for (int i = 0; i < (N); ++i) {
    if (A[i] == 0 || B[i] == 0) {
      if (A[i] == 0 && B[i] == 0)
        zero++;
      else if (A[i] == 0)
        azero++;
      else
        bzero++;
      continue;
    }
    long long g = gcd(abs(A[i]), abs(B[i]));
    v[i] = make_pair(A[i] / g, B[i] / g);
    long long a = A[i] / g, b = B[i] / g;
    if (mp.count(make_pair(a, b)))
      mp[make_pair(a, b)]++;
    else
      mp[make_pair(a, b)]++;
  }
  long long ans = 1;
  for (int i = 0; i < N; i++) {
    if (A[i] == 0 || B[i] == 0) continue;
    long long a = v[i].first;
    long long b = v[i].second;
    if (mp.count(make_pair(a, b)) == false) continue;
    long long n = mp[make_pair(a, b)];
    mp.erase(make_pair(a, b));
    if (mp.count(make_pair(-a, -b))) {
      n += mp[make_pair(-a, -b)];
      mp.erase(make_pair(-a, -b));
    }
    long long tar = 0;
    if (mp.count(make_pair(-b, a))) {
      tar += mp[make_pair(-b, a)];
      mp.erase(make_pair(-b, a));
    }
    if (mp.count(make_pair(b, -a))) {
      tar += mp[make_pair(b, -a)];
      mp.erase(make_pair(b, -a));
    }
    long long res = mod_pow(2, n);
    add(res, mod_pow(2, tar));
    add(res, MOD - 1);
    mul(ans, res);
  }
  long long num = mod_pow(2, azero);
  add(num, mod_pow(2, bzero));
  add(num, MOD - 1);
  mul(ans, num);
  add(ans, MOD - 1);
  cout << ans << endl;
  return 0;
}
