#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
const long long p = 1000000007;
long long mod_pow(long long a, long long N) {
  if (N == 0) return 1;
  if (N % 2 == 1) return (a * mod_pow(a, N - 1)) % p;
  long long tmp = mod_pow(a, N / 2);
  return (tmp * tmp) % p;
}
template <long long mod>
struct ModInt {
  long long x;
  ModInt() : x(0) {}
  ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod)) {}
  ModInt &operator+=(const ModInt &p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (long long)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
  friend istream &operator>>(istream &is, ModInt &a) {
    long long t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  ModInt inverse() const {
    long long a = x, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return ModInt(u);
  }
  ModInt pow(long long e) const {
    long long a = 1, p = x;
    while (e > 0) {
      if (e % 2 == 0) {
        p = (p * p) % mod;
        e /= 2;
      } else {
        a = (a * p) % mod;
        e--;
      }
    }
    return ModInt(a);
  }
};
using modint = ModInt<p>;
signed main() {
  long long N;
  cin >> N;
  long long sum = 0;
  map<pair<long long, long long>, long long> ma1, ma2;
  for (long long i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a != 0 and b != 0) {
      long long g = gcd(abs(a), abs(b));
      ma1[make_pair((a < 0 or b < 0 ? -abs(a) : abs(a)) / g, abs(b) / g)]++;
      ma2[make_pair((a < 0 or b < 0 ? abs(b) : -abs(b)) / g, abs(a) / g)]++;
    } else {
      if (a == 0 and b == 0) {
        sum++;
      } else if (a == 0 and b != 0) {
        ma1[make_pair(0, 1)]++;
        ma2[make_pair(-1, 0)]++;
      } else if (a != 0 and b == 0) {
        ma1[make_pair(1, 0)]++;
        ma2[make_pair(0, 1)]++;
      }
    }
  }
  modint ans = 1;
  for (auto p : ma1) {
    if (p.first.first < 0) continue;
    ans *= (mod_pow(2, p.second) + mod_pow(2, ma2[p.first]) - 1);
    sum += p.second;
    sum += ma2[p.first];
  }
  ans *= mod_pow(2, N - sum);
  cout << ans - 1 << endl;
}
