#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;
const ll MOD = 1e9 + 7;
template <class T>
void debug(T& v) {
  for (auto& x : v) cout << x << " ";
  cout << endl;
}
template <class T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll mypow(ll x, ll n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) {
      ret *= x;
      ret %= MOD;
    }
    x = x * x;
    x %= MOD;
    n /= 2;
  }
  return ret;
}
int main() {
  int N;
  cin >> N;
  vector<ll> A(N), B(N);
  for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
  for (int i = 0; i < N; i++) {
    if (A[i] == 0) {
      if (B[i] != 0) B[i] = 1;
    } else if (B[i] == 0) {
      A[i] = 1;
    } else {
      ll d = gcd(abs(A[i]), abs(B[i]));
      A[i] /= d;
      B[i] /= d;
      if (B[i] < 0) {
        A[i] = -A[i];
        B[i] = -B[i];
      }
    }
  }
  ll z = 0;
  map<Pll, ll> mp, mp2;
  for (int i = 0; i < N; i++) {
    if (A[i] == 0 && B[i] == 0)
      z++;
    else if (B[i] == 0 || A[i] > 0)
      mp[Pll(A[i], B[i])]++;
    else
      mp2[Pll(A[i], B[i])]++;
  }
  ll ans = 1;
  for (auto& p : mp) {
    auto itr = mp2.find(Pll(-p.first.second, p.first.first));
    if (itr == mp2.end())
      ans *= mypow(2, p.second);
    else
      ans *= mypow(2, p.second) + mypow(2, itr->second) - 1;
    ans %= MOD;
  }
  for (auto& p : mp2) {
    auto itr = mp.find(Pll(p.first.second, -p.first.first));
    if (itr == mp.end()) {
      ans *= mypow(2, p.second);
      ans %= MOD;
    }
  }
  cout << (ans + mypow(2, z) + MOD - 2) % MOD << endl;
}
