#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
  string sep = " ";
  if (v.size()) os << v[0];
  for (int i = 1; i < v.size(); i++) os << sep << v[i];
  return os;
}
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
struct rational {
  long long d, n;
  rational(long long denominator = 0, long long nominator = 1) {
    long long g = gcd(abs(denominator), abs(nominator));
    d = denominator / g;
    n = nominator / g;
    if (d == 0) n = 1;
    if (n < 0) {
      d = -d;
      n = -n;
    }
  }
  rational(pair<long long, long long> p) : rational(p.first, p.second) {}
  bool operator==(const rational& o) const { return d == o.d && n == o.n; }
  rational inv() const { return rational(n, d); }
  rational operator-() const { return rational(-d, n); }
  double operator()() const { return (double)d / n; }
  pair<long long, long long> to_pair() const { return {d, n}; }
};
long long ext_gcd(long long a, long long b, long long& x, long long& y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long nx, ny;
  long long g = ext_gcd(b, a % b, nx, ny);
  x = ny;
  y = nx - a / b * ny;
  return g;
}
struct mint {
  long long x, m;
  mint(long long x = 0, long long m = 1e9 + 7) : x((m + x % m) % m), m(m) {}
  mint operator-() const { return mint(m - x, m); }
  mint& operator+=(const mint o) {
    x = (x + o.x) % m;
    return *this;
  }
  mint& operator+=(const long long o) { return (*this) += mint(o, m); }
  mint& operator-=(const mint o) { return (*this) += (-o); }
  mint& operator-=(const long long o) { return (*this) -= mint(o, m); }
  mint& operator*=(const mint o) {
    x = x * o.x % m;
    return *this;
  }
  mint& operator*=(const long long o) { return (*this) *= mint(o, m); }
  mint& operator/=(const mint o) { return (*this) *= o.inv(); }
  mint& operator/=(const long long o) { return (*this) /= mint(o, m); }
  friend mint operator+(mint l, const mint r) {
    l += r;
    return l;
  }
  friend mint operator+(mint l, const long long r) {
    l += r;
    return l;
  }
  friend mint operator+(const long long l, mint r) {
    r += l;
    return r;
  }
  friend mint operator-(mint l, const mint r) {
    l -= r;
    return l;
  }
  friend mint operator-(mint l, const long long r) {
    l -= r;
    return l;
  }
  friend mint operator-(const long long l, mint r) {
    r -= l;
    return r;
  }
  friend mint operator*(mint l, const mint r) {
    l *= r;
    return l;
  }
  friend mint operator*(mint l, const long long r) {
    l *= r;
    return l;
  }
  friend mint operator*(const long long l, mint r) {
    r *= l;
    return r;
  }
  friend mint operator/(mint l, const mint r) {
    l /= r;
    return l;
  }
  friend mint operator/(mint l, const long long r) {
    l /= r;
    return l;
  }
  friend mint operator/(const long long l, const mint r) {
    return mint(l, r.m) / r;
  }
  bool operator==(const mint o) const { return x == o.x; }
  bool operator!=(const mint o) const { return x != o.x; }
  friend bool operator==(const long long l, const mint r) {
    return mint(l, r.m) == r;
  }
  friend bool operator!=(const long long l, const mint r) {
    return mint(l, r.m) != r;
  }
  friend std::ostream& operator<<(std::ostream& os, const mint x) {
    return os << x.x;
  }
  mint pow(long long k) const {
    if (k == 0) return mint(1, m);
    if (k % 2) return pow(k - 1) * x;
    mint z = pow(k / 2);
    return z * z;
  }
  mint inv() const {
    long long y, z;
    ext_gcd(x, m, y, z);
    return mint(y, m);
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  int nz = 0;
  int nbz = 0;
  map<pair<long long, long long>, int> c;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0 && b[i] == 0) {
      nz++;
    } else if (b[i] == 0) {
      nbz++;
    } else {
      c[rational(a[i], b[i]).to_pair()]++;
    }
  }
  mint ans(1);
  for (auto p : c) {
    int x = p.second;
    int y;
    if (p.first.first == 0) {
      y = nbz;
    } else {
      y = c[(-rational(p.first).inv()).to_pair()];
    };
    ans *= mint(2).pow(x) + mint(2).pow(y) - 1;
    c[p.first] = 0;
    c[(-rational(p.first).inv()).to_pair()] = 0;
  }
  ans += nz - 1;
  cout << ans << endl;
  return 0;
}
