#include <bits/stdc++.h>
struct Mint {
  static const long long mod = (long long)1e9 + 7;
  long long val;
  Mint() { val = 0; }
  Mint(long long a) {
    val = a;
    verify_value();
  }
  void verify_value() {
    if (val >= mod) val %= mod;
    if (val < 0) val %= mod, val += mod;
  }
  Mint pow(long long p) const {
    Mint cur = Mint(val), ret = 1;
    while (p > 0) {
      if (p & 1) ret *= cur;
      cur *= cur;
      p >>= 1LL;
    }
    return ret;
  }
  Mint inv() const {
    if (val == 0) std::cerr << "WARNING: inv() is called with 0." << std::endl;
    return pow(mod - 2);
  }
  Mint operator+() const { return *this; }
  Mint operator-() const { return Mint(mod - val); }
  Mint operator+=(const Mint &a) {
    val += a.val;
    if (val >= mod) val -= mod;
    return Mint(val);
  }
  Mint operator*=(const Mint &a) {
    val *= a.val;
    if (val >= mod) val %= mod;
    return Mint(val);
  }
  Mint operator-=(const Mint &a) { return *this += -a; }
  Mint operator/=(const Mint &a) { return *this *= a.inv(); }
  Mint operator++() { return *this += Mint(1); }
  Mint operator--() { return *this -= Mint(1); }
  Mint operator++(int) {
    Mint ret = *this;
    ++(*this);
    return ret;
  }
  Mint operator--(int) {
    Mint ret = *this;
    --(*this);
    return ret;
  }
  operator long long() const { return val; }
};
Mint operator+(const Mint &a, const Mint &b) {
  long long ret = a.val + b.val;
  if (ret >= Mint::mod) ret -= Mint::mod;
  return Mint(ret);
}
Mint operator*(const Mint &a, const Mint &b) {
  long long ret = a.val * b.val;
  if (ret >= Mint::mod) ret %= Mint::mod;
  return Mint(ret);
}
Mint operator-(const Mint &a, const Mint &b) { return a + (-b); }
Mint operator/(const Mint &a, const Mint &b) { return a * b.inv(); }
std::ostream &operator<<(std::ostream &out, const Mint &a) {
  return out << a.val;
}
std::istream &operator>>(std::istream &in, Mint &a) {
  in >> a.val;
  a.verify_value();
  return in;
}
Mint pow(Mint a, long long b) { return a.pow(b); }
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  std::cin >> n;
  std::vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++) {
    std::cin >> a[i] >> b[i];
    if (a[i] < 0) a[i] *= -1, b[i] *= -1;
    long long d = gcd(a[i], std::abs(b[i]));
    if (d == 0) return 0;
    a[i] /= d;
    b[i] /= d;
  }
  std::map<std::pair<long long, long long>, long long> cnt;
  for (int i = 0; i < n; i++) {
    cnt[{a[i], b[i]}]++;
  }
  Mint ans = 1;
  for (int i = 0; i < n; i++) {
    if (cnt[{a[i], b[i]}] == 0) continue;
    long long c, d;
    if (b[i] >= 0)
      c = b[i], d = -a[i];
    else
      c = -b[i], d = a[i];
    Mint k = Mint(1);
    if (cnt[{a[i], b[i]}] > 0) k += pow(Mint(2), cnt[{a[i], b[i]}]) - Mint(1);
    if (cnt[{c, d}] > 0) k += pow(Mint(2), cnt[{c, d}]) - Mint(1);
    ans *= k;
    cnt[{a[i], b[i]}] = 0;
    cnt[{c, d}] = 0;
  }
  std::cout << ans - Mint(1) << std::endl;
  return 0;
}
