#include <bits/stdc++.h>
using namespace std;
const int DIV = 1000000007;
int64_t gcdCalc(int64_t a, int64_t b) {
  while (b != 0) {
    int64_t r = a % b;
    a = b;
    b = r;
  }
  return a;
}
int64_t twoPow(int p) {
  if (p == 0) return 1;
  int64_t a = twoPow(p / 2);
  int64_t b = (p & 1) ? (a * 2) : a;
  return (a * b) % DIV;
}
int main(int argc, char* argv[]) {
  istream& f = cin;
  int n;
  f >> n;
  vector<int64_t> a(n), b(n);
  vector<pair<int64_t, int64_t>> ab(n);
  map<pair<int64_t, int64_t>, int> was;
  for (int i = 0; i < n; i++) {
    f >> a[i] >> b[i];
    int64_t gcd = gcdCalc(abs(a[i]), abs(b[i]));
    ab[i].first = a[i] / gcd;
    ab[i].second = b[i] / gcd;
    pair<int64_t, int64_t> tmp(-ab[i].first, -ab[i].second);
    if (tmp < ab[i]) ab[i] = tmp;
    auto it = was.find(ab[i]);
    if (it == was.end()) {
      was[ab[i]] = 1;
    } else {
      it->second++;
    }
  }
  int64_t count = 1;
  for (auto it = was.begin(); it != was.end(); it++) {
    auto p = it->first;
    int n = it->second;
    pair<int64_t, int64_t> opp(-p.second, p.first);
    auto tmp = make_pair(-opp.first, -opp.second);
    if (tmp < opp) opp = tmp;
    auto itOpp = was.find(opp);
    int64_t cur = n + 1;
    if (itOpp == was.end()) {
      cur = twoPow(n);
    } else {
      if (p < opp) {
        int m = itOpp->second;
        cur = twoPow(n) + twoPow(m) - 1;
        if (cur < 0) cur += DIV;
      } else {
        continue;
      }
    }
    count = (count * cur) % DIV;
  }
  count--;
  if (count < 0) count += DIV;
  printf("%lld\n", count);
  return 0;
}
