#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  return (b ? gcd(b, a % b) : a);
}
int64_t modpow(int64_t a, int64_t b, int64_t MOD) {
  int64_t ret = 1;
  while (b > 0) {
    if (b & 1) {
      (ret *= a) %= MOD;
    }
    (a *= a) %= MOD;
    b >>= 1;
  }
  return ret % MOD;
}
pair<int64_t, int64_t> tapu(int64_t a, int64_t b) {
  if (a == 0 && b != 0) {
    return {0, 1};
  }
  if (a != 0 && b == 0) {
    return {1, 0};
  }
  int64_t g = gcd(a, b);
  int64_t ag = abs(a) / g;
  int64_t bg = abs(b) / g;
  if ((a > 0 && b > 0) || (a < 0 && b < 0)) {
    return {ag, bg};
  } else {
    return {-ag, bg};
  }
};
int main() {
  constexpr int64_t MOD = 1e9 + 7;
  int N;
  cin >> N;
  vector<int64_t> A(N), B(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i] >> B[i];
  }
  map<pair<int64_t, int64_t>, int64_t> mp;
  for (int i = 0; i < N; ++i) {
    if (A[i] == 0 && B[i] == 0) {
      continue;
    }
    mp[tapu(A[i], B[i])] += 1;
  }
  int64_t ans = 1;
  for (auto it = mp.begin(); it != mp.end(); ++it) {
    if (it->second <= 0) {
      continue;
    }
    auto p = it->first;
    int64_t a = p.first, b = p.second;
    int64_t X = modpow(2, it->second, MOD);
    mp[{a, b}] = 0;
    int64_t Y = 0;
    if (a == 0 || b == 0) {
      Y = modpow(2, mp.count({b, a}) ? mp[{b, a}] : 0, MOD);
      mp[{b, a}] = 0;
    } else {
      Y = modpow(2, (mp.count({b, -a}) ? mp[{b, -a}] : 0), MOD);
      mp[{b, -a}] = 0;
    }
    (ans *= (X + Y - 1 + MOD) % MOD) %= MOD;
  }
  cout << (ans - 1 + MOD) % MOD << endl;
  return 0;
}
