#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll mod = 1e9 + 7;
template <class T = int64_t>
T bin_pow(T a, T n, T mod = 1e9 + 7) {
  T ans = 1;
  while (n > 0) {
    if (n & 1) ans = ans * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ans % mod;
}
template <class T = int64_t>
T inv_mod(T a, T mod = 1e9 + 7) {
  return bin_pow(a, mod - 2);
}
int main() {
  int n;
  cin >> n;
  ll ans = 1;
  map<double, int> bad;
  for (int i = 0; i < n; ++i) {
    ll a, b;
    cin >> a >> b;
    bad[(double)a / b]++;
    if (bad[(double)b / a * (-1)] == 0)
      ans = ans * 2 % mod;
    else {
      int m = bad[(double)b / a * (-1)];
      ans = ans * (2 * m + 1) % mod;
      if (ans >= bin_pow(2, m) && ans % bin_pow(2, m) == 0)
        ans /= bin_pow(2, m);
      else
        ans *= inv_mod(bin_pow(2, m)) % mod;
    }
  }
  cout << ans - 1 << endl;
}
