#include <bits/stdc++.h>
using namespace std;

constexpr int64_t mod = 1000000007;

int64_t power(int64_t n, int64_t k) {
  if (k == 0) return 1;
  int64_t res = power(n * n % mod, k / 2);
  if (k % 2) {
    res = res * n % mod;
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  map<pair<int64_t, int64_t>, int64_t> m;
  for (int i = 0; i < n; i++) {
    int64_t a, b, d;
    cin >> a >> b;
    if (a == 0 and b == 0) {
      continue;
    }
    d = gcd(abs(a), abs(b));
    a /= d;
    b /= d;
    if (a < 0 or (a == 0 and b < 0)) {
      a = -a;
      b = -b;
    }
    m[make_pair(a, b)]++;
    auto x = make_pair(b, -a);
    if (x.first < 0 or (x.first == 0 and x.second < 0)) {
      x.first = -x.first;
      x.second = -x.second;
    }
    m[x] += 0;
  }
  int64_t ans = 1;
  for (auto x : m) {
    auto y = make_pair(x.first.second, -x.first.first);
    if (y.first < 0 or (y.first == 0 and y.second < 0)) {
      y.first = -y.first;
      y.second = -y.second;
    }
    if (x.first > y) continue;
    ans *= (power(2, m[x.first]) + power(2, m[y]) + mod - 1) % mod;
    ans %= mod;
  }
  cout << (ans + mod - 1) % mod << endl;
}
