#include <bits/stdc++.h>
using namespace std;
using LL = int64_t;
using ULL = int64_t;
using P = pair<LL, LL>;
LL pow2(const LL n) {
  assert(n >= 0);
  LL prod = 1LL;
  for (LL i = 0; i < (n); ++i) {
    prod *= 2LL;
    prod %= 1000000007LL;
  }
  return prod;
}
LL count(map<pair<LL, LL>, pair<LL, LL>> &t) {
  LL prod = 1LL;
  for (const auto &e : t) {
    const auto n_colinear = e.second.first;
    const auto n_scalar = e.second.second;
    LL this_prod = pow2(n_scalar) + 1000000006LL;
    this_prod %= 1000000007LL;
    this_prod += pow2(n_colinear) + 1000000006LL;
    this_prod %= 1000000007LL;
    this_prod += 1LL;
    this_prod %= 1000000007LL;
    prod *= this_prod;
    prod %= 1000000007LL;
  }
  prod = (prod + 1000000006LL) % 1000000007LL;
  return prod;
}
LL gcd(LL n, LL m) {
  while (m % n != 0LL) {
    LL p = m % n;
    m = n;
    n = p;
  }
  return n;
}
LL gcd_w_swap(LL n, LL m) {
  if (n > m) {
    return gcd(m, n);
  } else {
    return gcd(n, m);
  }
}
int main() {
  map<pair<LL, LL>, pair<LL, LL>> t;
  LL n;
  cin >> n;
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  LL count_zero_zero = 0LL;
  for (LL i = 0; i < (n); ++i) {
    LL aa, bb;
    cin >> aa >> bb;
    if (aa == 0LL && bb == 0LL) {
      count_zero_zero++;
      continue;
    }
    if (bb == 0LL) {
      aa = 1LL;
    } else if (aa == 0LL) {
      bb = 1LL;
    } else {
      if (bb < 0) {
        aa *= -1;
        bb *= -1;
      }
      LL d = gcd_w_swap(abs(aa), bb);
      aa /= d;
      bb /= d;
    }
    auto cpair = make_pair(aa, bb);
    if (bb == 0) {
      cpair = make_pair(0LL, 1LL);
    } else if (aa < 0) {
      cpair = make_pair(bb, -aa);
    }
    try {
      auto pair_of_numbers = t.at(cpair);
      if (aa >= 0) {
        pair_of_numbers.first++;
      } else {
        pair_of_numbers.second++;
      }
      t[cpair] = pair_of_numbers;
    } catch (...) {
      auto pair_of_numbers = make_pair(1LL, 0LL);
      if (aa < 0) {
        pair_of_numbers = make_pair(0LL, 1LL);
      }
      t.insert(make_pair(cpair, pair_of_numbers));
    }
  }
  cout << (count(t) + count_zero_zero) % 1000000007LL << endl;
}
