#include <bits/stdc++.h>
using namespace std;
static const int64_t mod = 1000000007;
static const double INF = 10000000000000000000;
int64_t f(int64_t x, int64_t y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return (f(x, y / 2) * f(x, y / 2)) % mod;
  else
    return (x * (f(x, y / 2) * f(x, y / 2)) % mod) % mod;
}
int main() {
  int N;
  cin >> N;
  int64_t zero = 0;
  map<double, int64_t> M;
  for (int i = 0; i < N; i++) {
    double a, b;
    cin >> a >> b;
    if (a == 0) {
      if (b == 0)
        zero++;
      else {
        if (M.count(INF))
          M.at(INF)++;
        else
          M[INF] = 1;
      }
    } else {
      double k = b / a;
      if (M.count(k))
        M.at(k)++;
      else
        M[k] = 1;
    }
  }
  int64_t a = 0;
  vector<pair<int64_t, int64_t>> P;
  for (auto p : M) {
    auto k = p.first;
    auto v = p.second;
    if (k <= 0) {
      a += v;
      if (k != 0) {
        if (M.at(-1 / k)) {
          pair<int64_t, int64_t> p(v, M.at(-1 / k));
          P.push_back(p);
          a -= (v + M.at(-1 / k));
        }
      } else {
        if (M.at(INF)) {
          pair<int64_t, int64_t> p(v, M.at(-1 / k));
          P.push_back(p);
          a -= (v + M.at(INF));
        }
      }
    } else
      a += v;
  }
  int64_t ans = zero;
  int n = P.size();
  int64_t c = 1;
  for (int i = 0; i < N; i++) {
    int64_t F = P.at(i).first;
    int64_t s = P.at(i).second;
    c = (c * (f(2, F) + f(2, s) - 1)) % mod;
  }
  c = (c * f(2, a)) % mod;
  ans += c;
  ans = ans % mod;
  cout << ans << endl;
  return 0;
}
