#include <bits/stdc++.h>
using namespace std;
const int MAX = 200000;
const long long MOD = 1000000007;
long long GCD(long long a, long long b) {
  if (a == 0 || b == 0) return 0;
  if (a == 0) return b;
  if (b == 0) return a;
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  if (a % b) return GCD(b, a % b);
  return b;
}
long long mod_pow(long long x, long long n) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * x % MOD;
    x = x * x % MOD;
    n /= 2;
  }
  return ret;
}
void f(long long& A, long long& B) {
  if (A < 0) {
    A = -A;
    B = -B;
  }
  long long x = GCD(A, B);
  if (x == 0) return;
  A /= x;
  B /= x;
}
int main() {
  int N;
  long long A[MAX], B[MAX];
  map<pair<long long, long long>, int> m;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    f(A[i], B[i]);
    pair<long long, long long> p(A[i], B[i]);
    if (m.find(p) == m.end()) {
      m[p] = 1;
    } else {
      m[p]++;
    }
  }
  unsigned long long ans = 1;
  long long cnt = 0;
  map<pair<long long, long long>, bool> used;
  pair<long long, long long> zero(0, 0);
  used[zero] = true;
  for (auto it = m.begin(); it != m.end(); it++) {
    pair<long long, long long> p1 = it->first;
    long long a = p1.second;
    long long b = -p1.first;
    if (a < 0) {
      a = -a;
      b = -b;
    }
    pair<long long, long long> p2(a, b);
    if (used.find(p1) != used.end()) continue;
    if (m.find(p2) == m.end()) {
      cnt += m[p1];
      used[p1] = true;
    } else {
      ans = ans * ((mod_pow(2, m[p1]) + mod_pow(2, m[p2]) - 1) % MOD) % MOD;
      used[p1] = true;
      used[p2] = true;
    }
  }
  ans = (ans * mod_pow(2, cnt) + m[zero] - 1) % MOD;
  cout << ans << endl;
  return 0;
}
