#include <bits/stdc++.h>
using namespace std;
const int max_n = 200010;
const int mod = 1000000007;
vector<long long> a_list(max_n);
vector<long long> b_list(max_n);
struct mint {
  long long x;
  mint(long long 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(long long 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) const { 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; }
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};
combination comb(max_n);
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
void Main() {
  long long N, a, b;
  scanf("%lld", &N);
  ;
  mint total = 0;
  map<pair<long long, long long>, long long> ds;
  for (long long i = 0; i < N; ++i) {
    scanf("%lld", &a);
    ;
    scanf("%lld", &b);
    ;
    a_list[i] = a;
    b_list[i] = b;
    long long ag, bg;
    if (a == 0 && b != 0) {
      ag = 0;
      bg = 1;
    } else if (a != 0 && b == 0) {
      ag = 1;
      bg = 0;
    } else if (a == 0 && b == 0) {
      ag = 0;
      bg = 0;
    } else {
      long long tg = gcd(a, b);
      ag = a / tg;
      bg = b / tg;
      if (bg < 0) {
        bg = -bg;
        ag = -ag;
      }
    }
    ++ds[make_pair(ag, bg)];
  }
  mint tk = 1;
  mint base = 2;
  set<pair<long long, long long>> searched;
  for (auto p : ds) {
    if (searched.find(p.first) != searched.end()) {
      continue;
    }
    if (p.first.first == 0 && p.first.second == 0) {
      tk *= base.pow(p.second);
      continue;
    }
    auto invp2 = make_pair(p.first.second, -p.first.first);
    searched.insert(invp2);
    tk *= base.pow(p.second) + base.pow(ds[invp2]) - 1;
  }
  tk = tk - 1;
  cout << tk << endl;
}
int main() {
  Main();
  return 0;
}
