#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long extGCD(long long a, long long b, long long *px, long long *py) {
  if (b == 0) {
    *px = 1;
    *py = 0;
    return a;
  }
  long long d = extGCD(b, a % b, py, px);
  *py -= a / b * (*px);
  return d;
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  long long N;
  cin >> N;
  long long A, B;
  long long d, x, y, i, j;
  vector<pair<long long, long long>> nonzero;
  long long leftzero = 0, rightzero = 0;
  for (i = 1; i <= N; i++) {
    cin >> A >> B;
    if (A == 0 && B != 0) {
      leftzero++;
    } else if (A != 0 && B == 0) {
      rightzero++;
    } else if (A != 0 && B != 0) {
      if (A < 0 && B < 0) {
        A = -A;
        B = -B;
      }
      if (A > 0 && B < 0) {
        A = -A;
        B = -B;
      }
      d = extGCD(abs(A), B, &x, &y);
      A = A / d;
      B = B / d;
      nonzero.push_back({A, B});
    }
  }
  sort(nonzero.begin(), nonzero.end());
  vector<tuple<long long, long long, long long>> nonzero_counta;
  A = nonzero[0].first;
  B = nonzero[0].second;
  long long counta = 1;
  for (i = 1; i < nonzero.size(); i++) {
    if (A == nonzero[i].first && B == nonzero[i].second) {
      counta++;
    } else {
      nonzero_counta.push_back({A, B, counta});
      A = nonzero[i].first;
      B = nonzero[i].second;
      counta = 1;
    }
  }
  nonzero_counta.push_back({A, B, counta});
  long long friendly = 0;
  long long ans = 0;
  long long A_sub, B_sub, counta_sub;
  ans = (1 + (modpow(2, leftzero, MOD) - 1) + (modpow(2, rightzero, MOD) - 1)) %
        MOD;
  for (i = 0; i < nonzero_counta.size(); i++) {
    A = get<0>(nonzero_counta[i]);
    B = get<1>(nonzero_counta[i]);
    counta = get<2>(nonzero_counta[i]);
    if (A < 0) {
      j = lower_bound(nonzero_counta.begin(), nonzero_counta.end(),
                      make_tuple(B, -A, 1)) -
          nonzero_counta.begin();
    } else {
      j = lower_bound(nonzero_counta.begin(), nonzero_counta.end(),
                      make_tuple(-B, A, 1)) -
          nonzero_counta.begin();
    }
    if (j >= nonzero_counta.size()) {
      friendly += counta;
    } else {
      A_sub = get<0>(nonzero_counta[j]);
      B_sub = get<1>(nonzero_counta[j]);
      counta_sub = get<2>(nonzero_counta[j]);
      if (abs(A_sub) == B && B_sub == abs(A)) {
        if (A < 0) {
          ans = (ans * ((1 + (modpow(2, counta, MOD) - 1) +
                         (modpow(2, counta_sub, MOD) - 1)) %
                        MOD)) %
                MOD;
        }
      } else {
        friendly += counta;
      }
    }
  }
  ans = (ans * modpow(2, friendly, MOD)) % MOD;
  if (ans <= 0) {
    ans = MOD - 1;
  } else {
    ans--;
  }
  cout << ans << endl;
  system("pause");
  return 0;
}
