#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) { cout << (expr ? "Yes" : "No") << "\n"; }
lint power(lint x, lint n, lint mod) {
  lint ret = 1;
  while (n > 0) {
    if (n & 1) (ret *= x) %= mod;
    (x *= x) %= mod;
    n >>= 1;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  lint N;
  cin >> N;
  vector<lint> A(N);
  vector<lint> B(N);
  for (int i = (0), i_end_ = (N); i < i_end_; i++) {
    cin >> A[i] >> B[i];
  }
  lint zerozero = 0;
  lint Azero = 0;
  lint Bzero = 0;
  map<double, lint> cnt;
  for (int i = (0), i_end_ = (N); i < i_end_; i++) {
    if (A[i] == 0 && B[i] == 0) {
      zerozero++;
    } else if (A[i] == 0) {
      Azero++;
    } else if (B[i] == 0) {
      Bzero++;
    } else {
      lint x = A[i] * power(B[i], MOD - 2, MOD) % MOD;
      if (cnt.find(x) == cnt.end()) {
        cnt[x] = 1;
      } else {
        cnt[x]++;
      }
    }
  }
  vector<pair<lint, lint>> pa;
  pa.push_back(make_pair(Azero, Bzero));
  for (int i = (0), i_end_ = (N); i < i_end_; i++) {
    if (A[i] != 0 && B[i] != 0) {
      lint x = A[i] * power(B[i], MOD - 2, MOD) % MOD;
      lint y = -B[i] * power(A[i], MOD - 2, MOD) % MOD;
      if (cnt[x] > 0 || cnt[y] > 0) {
        pa.push_back(make_pair(cnt[x], cnt[y]));
        cnt[x] = 0;
        cnt[y] = 0;
      }
    }
  }
  lint ans = 1;
  for (int i = (0), i_end_ = (pa.size()); i < i_end_; i++) {
    ans = ans *
          (((power(2, pa[i].first, MOD) - 1) +
            (power(2, pa[i].second, MOD) - 1) + 1 + MOD) %
           MOD) %
          MOD;
  }
  ans = (ans - 1 + MOD) % MOD;
  cout << ans << endl;
}
