#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
int gcd(lint a, lint b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
int main() {
  lint mod = 1000000007;
  lint n;
  cin >> n;
  vector<lint> a(n), b(n);
  map<pint, lint> m;
  for (int i = (0), i_end_ = (n); i < i_end_; i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 && b[i] == 0) {
      continue;
    }
    if (a[i] == 0) {
      b[i] = -1;
    } else if (b[i] == 0) {
      a[i] = 1;
    } else {
      lint x = gcd(abs(a[i]), abs(b[i]));
      a[i] /= x;
      b[i] /= x;
    }
    pint p = make_pair(a[i], b[i]);
    if (!m.count(p)) {
      m[p] = 1;
    } else {
      m[p] = m[p] + 1;
    }
  }
  lint ans = 1;
  for (auto pp : m) {
    pint p = pp.first;
    pint p1 = make_pair(p.second, -p.first);
    pint p2 = make_pair(-p.second, p.first);
    lint z = 0;
    if (m.count(p1)) {
      z = z + m.at(p1);
      m[p1] = 0;
    }
    if (m.count(p2)) {
      z = z + m.at(p2);
      m[p2] = 0;
    }
    lint tmp = pow(2, z) + pow(2, pp.second) - 1;
    ans = (ans * tmp) % mod;
    m[p] = 0;
  }
  cout << (((ans + mod) - 1) % mod) << "\n";
  return 0;
}
