#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int64_t modpow(int64_t a, int64_t n, int64_t mod) {
  int64_t ret = 1;
  while (n > 0) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n /= 2;
  }
  return ret;
}

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  map<pair<int64_t, int64_t>, pair<int, int>> memo;
  int nZZ = 0;
  rep(i, N) {
    int x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      ++nZZ;
      continue;
    }

    int64_t g = std::gcd(x, y);
    x /= g;
    y /= g;
    if (y <= 0) {
      x = -x;
      y = -y;
    }
    if (x < 0) {
      int64_t tmp = x;
      x = y;
      y = -tmp;
      memo[{x, y}].first++;
    } else {
      memo[{x, y}].second++;
    }
  }

  const int64_t mod = 1e9 + 7;
  int64_t answer = 1;
  for (auto& group : memo) {
    int64_t s = group.second.first;
    int64_t t = group.second.second;

    int64_t now = 1;
    now = (now + modpow(2, s, mod) - 1 + mod) % mod;
    now = (now + modpow(2, t, mod) - 1 + mod) % mod;
    answer = (answer * now) % mod;
  }
  answer = (answer - 1 + mod) % mod;
  answer = (answer + nZZ) % mod;
  cout << answer << endl;
  return 0;
}
