#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<ll> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
  }
  map<pair<ll, ll>, P> mp;
  vector<int> jj(3);
  for (int i = 0; i < n; ++i) {
    if (a[i] != 0 && b[i] != 0) {
      ll a_ = abs(a[i]);
      ll b_ = abs(b[i]);
      if (a_ < b_) {
        swap(a_, b_);
      }
      while (a_ % b_) {
        int cc = a_ % b_;
        a_ = b_;
        b_ = cc;
      }
      a[i] /= b_;
      b[i] /= b_;
      if ((a[i] < 0 && b[i] < 0) || (a[i] > 0 && b[i] > 0)) {
        a[i] = abs(a[i]);
        b[i] = abs(b[i]);
        mp[make_pair(a[i], b[i])].first++;
      } else {
        a[i] = abs(a[i]);
        b[i] = abs(b[i]);
        mp[make_pair(b[i], a[i])].second++;
      }
    } else if (a[i] == 0 && b[i] != 0) {
      jj[0]++;
    } else if (a[i] != 0 && b[i] == 0) {
      jj[1]++;
    } else {
      jj[2]++;
    }
  }
  mint ans = 1;
  for (auto x : mp) {
    ans *= mint(2).pow(x.second.first) + mint(2).pow(x.second.second) - 1;
  }
  ans *= (mint(2).pow(jj[0]) + mint(2).pow(jj[1]) - 1);
  ans += jj[2];
  cout << ans - 1 << endl;
}
