#include <bits/stdc++.h>
using namespace std;
long long pow(long long N, long long P) {
  if (P == 0) return 1;
  if (P % 2 == 0) {
    long long t = pow(N, P / 2);
    return t * t;
  }
  return N * pow(N, P - 1);
}
long long modpow(long long N, long long P, long long k) {
  if (P == 0) return 1;
  if (P % 2 == 0) {
    long long t = modpow(N, P / 2, k) % k;
    return t * t % k;
  }
  return N * modpow(N, P - 1, k) % k;
}
long long modkai(long long n, long long m, long long k) {
  if (n == m) return 1;
  return modkai(n - 1, m, k) * n % k;
}
long long mod_cnb(long long n, long long m, long long k) {
  int m_ = modkai(m, 0, k);
  return modkai(n, n - m, k) * modpow(m_, k - 2, k) % k;
}
long long gcd(long long n, long long m) {
  n = abs(n);
  m = abs(m);
  if (n * m == 0) return max(n, m);
  long long n_ = max(n, m);
  long long m_ = min(n, m);
  if (n_ % m_ == 0) return m_;
  return gcd(m_, n_ % m_);
}
long long lcm(long long n, long long m) { return n * m / gcd(n, m); }
int main() {
  long long k = 1e9 + 7;
  long long n;
  cin >> n;
  map<vector<long long>, long long[2]> m;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    vector<long long> c(2);
    if (a == 0 && b == 0) continue;
    if (a == 0) {
      c[0] = 0;
      c[1] = 1;
      if (m.find(c) == m.end()) {
        m[c][0] = 1;
        m[c][1] = 0;
      } else
        m[c][0]++;
      continue;
    }
    if (b == 0) {
      c[0] = 0;
      c[1] = 1;
      if (m.find(c) == m.end()) {
        m[c][1] = 1;
        m[c][0] = 0;
      } else
        m[c][1]++;
      continue;
    }
    long long g = gcd(a, b);
    a /= g;
    b /= g;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    if (b < 0) {
      c[0] = -b;
      c[1] = a;
      if (m.find(c) == m.end()) {
        m[c][1] = 1;
        m[c][0] = 0;
      } else
        m[c][1]++;
    } else {
      c[0] = a;
      c[1] = b;
      if (m.find(c) == m.end()) {
        m[c][0] = 1;
        m[c][1] = 0;
      } else
        m[c][0]++;
    }
  }
  long long ans = 1;
  for (auto itr = m.begin(); itr != m.end(); itr++) {
    ans = ans *
          (modpow(2, itr->second[0], k) + modpow(2, itr->second[1], k) - 1) % k;
  }
  cout << ans - 1 << endl;
}
