#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
const long long MOD = 1e9 + 7;
long long _gcd(long long a, long long b) {
  if (b == 0) return a;
  return _gcd(b, a % b);
}
long long gcd(long long a, long long b) {
  a = abs(a), b = abs(b);
  if (a < b) swap(a, b);
  return _gcd(a, b);
}
int N;
long long A[MAXN];
long long B[MAXN];
map<pair<long long, long long>, int> cnt;
long long qpow(long long a, long long n) {
  long long rt = 1;
  while (n) {
    if (n & 1) rt = (rt * a) % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return rt;
}
long long factor[MAXN];
void calfact() {
  factor[0] = 1;
  for (int u = 1; u < MAXN; u++) {
    factor[u] = factor[u - 1] * u % MOD;
  }
}
long long C(int n, int m) {
  assert(n >= m);
  return factor[n] * qpow(factor[m], MOD - 2) * qpow(factor[n - m], MOD - 2);
}
long long collect(long long a, long long b) {
  long long rt = 0;
  rt += cnt[{a, b}];
  rt += cnt[{-a, -b}];
  return rt;
}
void erase(long long a, long long b) {
  cnt[{a, b}] = 0;
  cnt[{-a, -b}] = 0;
}
int zero = 0;
void read() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  calfact();
  cin >> N;
  for (int u = 1; u <= N; u++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    long long g = gcd(a, b);
    assert(g != 0);
    cnt[{a / g, b / g}]++;
    A[u] = a / g;
    B[u] = b / g;
  }
}
void solve() {
  read();
  long long ans = 1;
  for (int u = 1; u <= N; u++) {
    if (cnt[{A[u], B[u]}] == 0) continue;
    long long t1 = collect(A[u], B[u]), t2 = collect(-B[u], A[u]);
    ans = ans * ((qpow(2, t1) + qpow(2, t2) - 1) % MOD) % MOD;
    erase(A[u], B[u]);
    erase(-B[u], A[u]);
  }
  ans = (ans + zero - 1) % MOD;
  cout << ans;
}
int main() { solve(); }
