#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  if (a < b) swap(a, b);
  while (b > 0) {
    int t = b;
    b = a % b;
    a = t;
  }
  return a > 0 ? a : 1;
}
long long powmod(long long x, long long n, unsigned int m) {
  long long res = 1 % m;
  x %= m;
  for (; n > 0; n >>= 1) {
    if (n & 1) {
      res = (res * x) % m;
    }
    x = (x * x) % m;
  }
  return res;
}
const size_t SEED =
    chrono::high_resolution_clock::now().time_since_epoch().count();
struct Fraction {
  long long num, den;
  Fraction(long long n, long long d) {
    long long g = gcd(n, d);
    num = n / g;
    den = d / g;
    if (den < 0) {
      num = -num;
      den = -den;
    }
    if (den == 0) num = 1;
  }
  bool operator==(const Fraction& f) const {
    return num == f.num && den == f.den;
  }
  string to_string() const {
    return std::to_string(num) + "/" + std::to_string(den);
  }
};
struct FractionHash {
  size_t operator()(const Fraction& f) const {
    size_t res = hash<long long>{}(f.num ^ (f.den << 1));
    return hash<int>{}(res ^ SEED);
  }
};
const int MOD = 1e9 + 7;
int solve(int N, const vector<long long>& A, const vector<long long>& B) {
  int cnt_zeros = 0;
  unordered_map<Fraction, int, FractionHash> freq;
  for (int i = 0, _n = (N); i < _n; ++i) {
    long long x = A[i], y = B[i];
    if (x == 0 && y == 0)
      ++cnt_zeros;
    else
      ++freq[Fraction(x, y)];
  }
  if (cnt_zeros == N) return N;
  long long res = 1;
  while (!freq.empty()) {
    auto it1 = freq.begin();
    Fraction f = it1->first;
    int cnt1 = it1->second;
    freq.erase(it1);
    long long factor = 0;
    Fraction invf(-f.den, f.num);
    auto it2 = freq.find(invf);
    if (it2 != freq.end()) {
      int cnt2 = it2->second;
      freq.erase(it2);
      factor = powmod(2, cnt1, MOD) - 1 + powmod(2, cnt2, MOD) - 1 + 1;
      factor %= MOD;
    } else
      factor = powmod(2, cnt1, MOD);
    res = (res * factor) % MOD;
  }
  res += cnt_zeros;
  if (res >= MOD) res -= MOD;
  res--;
  if (res < 0) res += MOD;
  return res;
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  for (int i = 0, _n = (N); i < _n; ++i) cin >> A[i] >> B[i];
  int res = solve(N, A, B);
  cout << res << '\n';
  return 0;
}
