#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ldouble = long double;
const int mod = 1000000007;
struct mint {
  int64_t x;
  mint(int64_t x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(int64_t t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
int main() {
  int n;
  cin >> n;
  vector<ll> b(n);
  vector<ldouble> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
  }
  map<ldouble, int> mp;
  vector<int> jj(3);
  for (int i = 0; i < n; ++i) {
    if (a[i] != 0.0 && b[i] != 0)
      mp[b[i] / a[i]]++;
    else if (a[i] == 0.0 && b[i] != 0) {
      jj[0]++;
    } else if (a[i] != 0.0 && b[i] == 0) {
      jj[1]++;
    } else {
      jj[2]++;
    }
  }
  mint ans = 1;
  mint m2 = 2;
  for (auto x : mp) {
    if (x.second == -1) continue;
    if (!mp.count(-1.0 / x.first)) {
      ans *= m2.pow(x.second);
    } else {
      ans *= (m2.pow(x.second) + m2.pow(mp[-1.0 / x.first]) - 1);
      mp[-1 / x.first] = -1;
    }
  }
  if (jj[0] && jj[1]) {
    ans *= (m2.pow(jj[0]) + m2.pow(jj[1]) - 1);
  } else {
    ans *= m2.pow(jj[0]);
    ans *= m2.pow(jj[1]);
  }
  ans += jj[2];
  cout << ans - 1 << endl;
}
