#include <bits/stdc++.h>
using namespace std;
long long N = pow(10, 9) + 7;
long long gcd(long long a, long long b) {
  long long m, n;
  m = max(abs(a), abs(b));
  n = min(abs(a), abs(b));
  if (m % n == 0)
    return n;
  else
    return gcd(m % n, n);
}
long long mod_pow2(long long n) {
  if (n == 0)
    return 1;
  else {
    long long k = (mod_pow2(n / 2) * mod_pow2(n / 2)) % N;
    if (n % 2 == 0)
      return k;
    else
      return (k * 2) % N;
  }
}
int main() {
  long long n;
  cin >> n;
  long long bothzero = 0;
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i) >> b.at(i);
    if (a.at(i) == 0 && b.at(i) == 0) bothzero++;
  }
  long long nonzero = n - bothzero;
  vector<pair<long long, long long>> I;
  for (int i = 0; i < n; i++) {
    pair<long long, long long> p;
    if (a.at(i) == 0 && b.at(i) == 0) {
      continue;
    } else if (a.at(i) == 0) {
      p = make_pair(0, 1);
    } else if (b.at(i) == 0) {
      p = make_pair(1, 0);
    } else {
      long long g = gcd(a.at(i), b.at(i));
      p = make_pair(a.at(i) / g, b.at(i) / g);
      if (p.first < 0) {
        p.first *= -1;
        p.second *= -1;
      }
    }
    I.push_back(p);
  }
  map<pair<long long, long long>, pair<long long, long long>> m;
  for (int i = 0; i < I.size(); i++) {
    pair<long long, long long> p, p_inv;
    p = I.at(i);
    p_inv.first = p.second;
    p_inv.second = p.first;
    if (p_inv.first >= 0)
      p_inv.second *= -1;
    else
      p_inv.first *= -1;
    if (m.count(p)) {
      m.at(p).first++;
    } else if (m.count(p_inv)) {
      m.at(p_inv).second++;
    } else {
      pair<long long, long long> q = make_pair(1, 0);
      m[p] = q;
    }
  }
  long long ans = 1;
  for (auto p : m) {
    pair<long long, long long> q;
    q = p.second;
    ans = ans * ((mod_pow2(q.first) + mod_pow2(q.second) - 1) % N);
    ans %= N;
  }
  cout << (ans - 1 + bothzero) % N << endl;
}
