#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
struct rational {
  rational(long long n, long long d) {
    if (n != 0 && d != 0) {
      if (d < 0) {
        n *= -1;
        d *= -1;
      }
      long long g = gcd(abs(n), abs(d));
      num = n / g;
      den = d / g;
    } else if (n == 0) {
      num = 0;
      den = 1;
    } else if (d == 0) {
      num = 1;
      den = 0;
    } else {
      num = 0;
      den = 0;
    }
  }
  bool operator<(const rational& other) const {
    return tie(num, den) < tie(other.num, other.den);
  }
  long long num;
  long long den;
};
const int MOD = 1000000007;
int addm(int a, int b) { return (0LL + a + b) % MOD; }
int subm(int a, int b) { return addm(a, MOD - b); }
int mulm(int a, int b) { return (1LL * a * b) % MOD; }
int main() {
  int N;
  cin >> N;
  vector<int> pow2(N + 1);
  pow2[0] = 1;
  for (int i = 1; i <= N; ++i) {
    pow2[i] = mulm(2, pow2[i - 1]);
  }
  map<rational, int> m;
  set<rational> used;
  for (int i = 0; i < N; ++i) {
    long long A, B;
    cin >> A >> B;
    rational r(A, B);
    ++m[r];
  }
  int ans = 1;
  for (const auto& e : m) {
    rational r1 = e.first;
    rational r2(0, 0);
    int c1 = e.second;
    int c2;
    if (r1.num == 0 && r1.den == 0) {
      continue;
    }
    if (r1.num == 0 && r1.den == 1) {
      r2 = rational(1, 0);
    } else if (r1.num == 1 && r1.den == 0) {
      r2 = rational(0, 1);
    } else {
      long long num = -r1.den;
      long long den = r1.num;
      if (den < 0) {
        num *= -1;
        den *= -1;
      }
      r2 = rational(num, den);
    }
    used.insert(r1);
    if (used.count(r2)) {
      continue;
    }
    if (m.count(r2) == 0) {
      c2 = 0;
    } else {
      c2 = m.at(r2);
    }
    int tmp = 0;
    tmp = addm(tmp, pow2[c1]);
    tmp = addm(tmp, pow2[c2]);
    tmp = subm(tmp, 1);
    ans = mulm(ans, tmp);
  }
  ans = subm(ans, 1);
  ans = addm(ans, m[rational(0, 0)]);
  cout << ans << endl;
}
