#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
constexpr long long mod = 1e9 + 7;
constexpr long long inf = 3e18;
long long mod_pow(long long x, long long y, long long m = mod) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) (res *= x) %= m;
    (x *= x) %= m;
    y >>= 1;
  }
  return res;
}
long long N;
long double A[200005], B[200005];
map<long double, long long> mp;
signed main() {
  cin >> N;
  vector<long double> v;
  long long za = 0, zb = 0, memo = 0;
  for (long long i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    if (A[i] && B[i]) {
      mp[A[i] / B[i]]++;
      v.push_back(A[i] / B[i]);
    } else {
      if (!A[i] && B[i]) za++;
      if (A[i] && !B[i]) zb++;
      if (!A[i] && !B[i]) memo++;
    }
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  long long i = 0;
  while (i < (long long)v.size()) {
    long long j = i + 1;
    while (j < (long long)v.size() && v[j] - v[i] < 1e-9) {
      v[i] += v[j];
      v[j] = 0;
      j++;
    }
    i = j;
  }
  long long ans = 1;
  for (long long i = 0; i < (long long)v.size(); i++) {
    if (v[i] > 0 && mp[-1 / v[i]]) continue;
    ans *= (mod_pow(2, mp[v[i]]) + mod_pow(2, mp[-1 / v[i]]) + mod - 1) % mod;
    ans %= mod;
  }
  ans *= (mod_pow(2, za) - 1 + mod_pow(2, zb) + mod) % mod;
  ans %= mod;
  cout << (ans + memo + mod - 1) % mod << endl;
}
