#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5;
const int MOD = 1000000007;
const double INF = 2e18;
const double EPS = 1e-10;
class gf {
 public:
  int n;
  static gf mod_inv(int a, int m) {
    int u = 0, v = 1;
    while (a != 0) {
      int t = m / a;
      m -= t * a;
      u -= t * v;
      swap(a, m);
      swap(u, v);
    }
    return gf(u);
  }
  gf() : n(0) {}
  gf(int n) : n(n < 0 ? n % MOD + MOD : n % MOD) {}
  gf operator+(gf x) { return gf((n + x.n) % MOD); }
  gf operator-(gf x) { return gf((n - x.n + MOD) % MOD); }
  gf operator*(gf x) { return gf((1LL * n * x.n) % MOD); }
  gf operator/(gf x) { return *this * x.inv(); }
  gf& operator+=(gf x) { return *this = (*this + x); }
  gf& operator-=(gf x) { return *this = (*this - x); }
  gf& operator*=(gf x) { return *this = (*this * x); }
  gf& operator/=(gf x) { return *this = (*this / x); }
  gf inv() { return mod_inv(n, MOD); }
};
int N;
long long int A[MAX_N], B[MAX_N];
long long int gcd(long long int a, long long int b) {
  a = abs(a), b = abs(b);
  while (b != 0) {
    swap(b, a %= b);
  }
  return a;
}
long long int solve() {
  gf p2[MAX_N + 1];
  p2[0] = 1;
  for (int i = 0; i < N; i++) {
    p2[i + 1] = p2[i] * 2;
  }
  map<pair<int, int>, int> m;
  for (int i = 0; i < N; i++) {
    long long int g = gcd(A[i], B[i]);
    pair<int, int> p = B[i] >= 0 ? pair<int, int>(A[i] / g, B[i] / g)
                                 : pair<int, int>(-A[i] / g, -B[i] / g);
    m[p]++;
  }
  int z = m[pair<int, int>(0, 0)];
  m.erase(pair<int, int>(0, 0));
  gf ans = 1;
  while (!m.empty()) {
    auto p = *m.begin();
    pair<int, int> k = p.first;
    int x = p.second;
    int y = m[pair<int, int>(-k.second, k.first)] +
            m[pair<int, int>(k.second, -k.first)];
    ans *= p2[x] + p2[y] - 1;
    m.erase(k);
    m.erase(pair<int, int>(-k.second, k.first));
    m.erase(pair<int, int>(k.second, -k.first));
  }
  ans += z - 1;
  return ans.n;
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
  }
  cout << solve() << endl;
  return 0;
}
