#include <bits/stdc++.h>
using namespace std;
int p = 1000000007;
long long gcd(long long m, long long n) {
  while (m > 0 && n > 0) {
    n = n % m;
    if (n > 0) m = m % n;
  }
  if (n == 0)
    return m;
  else
    return n;
}
long long pow_rem_p(long long a, long long n) {
  long long ff, f, nn;
  ff = a;
  f = 1;
  nn = n;
  while (nn > 0) {
    if (nn % 2 == 1) {
      f *= ff;
      f %= p;
    }
    ff *= ff;
    ff %= p;
    nn /= 2;
  }
  return f;
}
int main() {
  int n, i, t = 0, s = 0, z = 0;
  long long a, b, m, res = 1;
  bool f;
  vector<pair<pair<long long, long long>, bool> > ab;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      z++;
    } else if (a == 0) {
      ab.emplace_back(pair<long long, long long>(0, 1), 0);
    } else if (b == 0) {
      ab.emplace_back(pair<long long, long long>(0, 1), 1);
    } else {
      f = 0;
      if (a < 0) {
        a = -a;
        f = 1;
      }
      if (b < 0) {
        b = -b;
        f = 1 - f;
      }
      m = gcd(a, b);
      a /= m;
      b /= m;
      if (f == 0) {
        ab.emplace_back(pair<long long, long long>(a, b), 0);
      } else {
        ab.emplace_back(pair<long long, long long>(b, a), 1);
      }
    }
  }
  sort(ab.begin(), ab.end());
  for (i = 0; i < ab.size(); i++) {
    if (i > 0 && ab[i] == ab[i - 1]) {
      if (ab[i].second == 0)
        s++;
      else
        t++;
    } else if (i > 0 && ab[i].first == ab[i - 1].first) {
      t = 1;
    } else {
      if (i > 0) {
        if (s == 0 || t == 0)
          res *= pow_rem_p(2, s + t);
        else
          res *= pow_rem_p(2, s) + pow_rem_p(2, t) - 1;
        res %= p;
        s = 0;
        t = 0;
      }
      if (ab[i].second == 0)
        s++;
      else
        t++;
    }
  }
  if (s == 0 || t == 0)
    res *= pow_rem_p(2, s + t);
  else
    res *= pow_rem_p(2, s) + pow_rem_p(2, t) - 1;
  res += z - 1;
  res %= p;
  cout << res << endl;
  return 0;
}
