#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long a[200005], b[200005], mod = 1000000007;
map<double, long long> m;
vector<pair<long long, long long>> vec;
long long power(long long n, long long m) {
  if (!m) return 1;
  long long v = power(n, m >> 1);
  if (m & 1) return v * v % mod * n % mod;
  return v * v % mod;
}
int main() {
  long long i, n, ans = 1, zero = 0, cnt = 0;
  scanf("%lld", &n);
  for (i = 1; i <= n; i++) scanf("%lld%lld", &a[i], &b[i]);
  for (i = 1; i <= n; i++) {
    if (!a[i] || !b[i])
      zero++;
    else
      m[(double)a[i] / b[i]]++;
  }
  for (auto it = m.begin(); it != m.end();) {
    auto x = m.find((double)-1 / (*it).first);
    if (x != m.end()) {
      vec.emplace_back((*it).second, (*x).second);
      cnt += (*it).second + (*x).second;
      m.erase(x);
      it++;
    } else
      it++;
  }
  ans = power(2, n - cnt - zero);
  for (auto x : vec) {
    long long v =
        ((power(2, x.first) + power(2, x.second)) % mod - 1 + mod) % mod;
    ans = ans * v % mod;
  }
  ans = ans * (zero + 1) % mod;
  printf("%lld\n", (ans - 1 + mod) % mod);
}
