#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void solve() {
  long long n;
  cin >> n;
  long long st[n + 1];
  st[0] = 1;
  for (long long i = 1; i <= n; ++i) st[i] = (st[i - 1] * 2) % mod;
  map<double, long long> kek;
  set<double> lol;
  long long cnt = 0;
  for (long long i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    if (b == 0) {
      if (a) ++cnt;
      continue;
    }
    ++kek[a / (b + 0.0)];
    lol.insert(a / (b + 0.0));
  }
  long long ans = 1;
  while (!lol.empty()) {
    double val = *lol.begin();
    lol.erase(val);
    if (val == 0) continue;
    if (lol.find(-1.0 / val) == lol.end())
      ans = (ans * st[kek[val]]) % mod;
    else {
      ans = (ans * (st[kek[val]] - 1 + st[kek[-1.0 / val]] + mod)) % mod;
      lol.erase(-1.0 / val);
    }
  }
  ans = (ans * (st[cnt] - 1 + st[kek[0]] + mod)) % mod;
  cout << (ans - 1 + mod) % mod;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
