#include <bits/stdc++.h>
template <class T>
bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9 + 7;
struct mint {
  ll x;
  mint(ll 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(ll 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; }
ll gcd(ll a, ll b) { return (b ? gcd(b, a % b) : a); }
int main() {
  int n;
  cin >> n;
  vector<P> x, y;
  int zeros = 0;
  for (int i = 0; i < (int)(n); i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      zeros++;
    else if (a < 0 && b > 0)
      y.push_back(P(-a, b));
    else if (a > 0 && b < 0)
      y.push_back(P(a, -b));
    else
      x.push_back(P(a, b));
  }
  map<P, int> x_, y_;
  for (int i = 0; i < (int)(x.size()); i++) {
    ll a = x[i].first;
    ll b = x[i].second;
    ll gc = gcd(a, b);
    a /= gc;
    b /= gc;
    x_[P(a, b)]++;
  }
  for (int i = 0; i < (int)(y.size()); i++) {
    ll a = y[i].first;
    ll b = y[i].second;
    ll gc = gcd(a, b);
    a /= gc;
    b /= gc;
    y_[P(b, a)]++;
  }
  int rem_x = 0;
  int rem_y = 0;
  mint ans = 1;
  for (auto p : x_) {
    if (p.second == 0) continue;
    if (y_[p.first] != 0) {
      ans *= (mint(2).pow(p.second) - 1) + (mint(2).pow(y_[p.first]) - 1) + 1;
    } else
      rem_x++;
  }
  for (auto p : y_) {
    if (p.second == 0) continue;
    if (x_[p.first] == 0) rem_y++;
  }
  int rem = rem_x + rem_y;
  ans *= mint(2).pow(rem);
  ans += zeros - 1;
  cout << ans << endl;
}
