#include <bits/stdc++.h>
using namespace std;
struct Sardine {
  Sardine(long long a, long long b) : A(a), B(b) {
    if (a == 0)
      B = 1;
    else if (b == 0)
      A = 1;
    else {
      long long gcd_ab = gcd(a, b);
      if (gcd_ab != 0) {
        A /= gcd_ab;
        B /= gcd_ab;
      }
      if (B < 0) {
        B = -B;
        A = -A;
      }
    }
  }
  Sardine GetInCompatible() const { return Sardine(-B, A); }
  bool operator==(const Sardine& rhs) const {
    return !(*this < rhs) && !(rhs < *this);
  }
  bool operator<(const Sardine& rhs) const {
    return (A == rhs.A) ? (B < rhs.B) : (A < rhs.A);
  }
  long long A, B;
  long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
};
long long GetCombination(long long num, long long mod) {
  long long comb = 1;
  for (long long i = 0; i < num; ++i) {
    comb *= 2;
    comb %= mod;
  }
  return comb;
}
int main() {
  auto& in = cin;
  long long N;
  in >> N;
  map<Sardine, long long> groups;
  long long numZeros = 0;
  for (long long i = 0; i < N; ++i) {
    long long a, b;
    in >> a >> b;
    if (a == 0 && b == 0)
      ++numZeros;
    else
      ++groups[Sardine(a, b)];
  }
  const long long mod = 1000000007;
  long long count = 1;
  for (auto& gr : groups) {
    long long num1 = gr.second;
    if (num1 == 0) continue;
    auto itBad = groups.find(gr.first.GetInCompatible());
    long long num2 = 0;
    if (itBad != groups.end()) {
      num2 = itBad->second;
      itBad->second = 0;
    }
    num1 = GetCombination(num1, mod);
    num2 = GetCombination(num2, mod);
    count *= (num1 + num2 - 1) % mod;
    count %= mod;
  }
  cout << (count + numZeros - 1) % mod;
  return 0;
}
