#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;
template <typename T1, typename T2>
inline void chmin(T1 &a, const T2 &b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, const T2 &b) {
  if (a < b) a = b;
}
const long long MAXN = 1001024;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long extgcd(long long a, long long b, long long &x, long long &y) {
  long long d = a;
  if (b != 0) {
    d = extgcd(b, a, y, x);
    y -= (a / b) * x;
  } else {
    x = 1;
    y = 0;
  }
  return d;
}
long long prime[MAXN];
bool is_prime[MAXN];
bool is_prime_ab[MAXN];
long long sieve(long long n) {
  long long res = 0;
  fill(is_prime, is_prime + MAXN, true);
  is_prime[0] = is_prime[1] = false;
  for (long long i = 2; i <= n; ++i) {
    if (!is_prime[i]) continue;
    prime[res++] = i;
    for (long long j = 2 * i; j <= n; j += i) is_prime[j] = false;
  }
  return res;
}
vector<long long> divisors(long long n) {
  vector<long long> res;
  for (long long i = 1; i * i <= n; ++i) {
    if (n % i != 0) continue;
    res.push_back(i);
    if (n / i == i) continue;
    res.push_back(n / i);
  }
  sort(res.begin(), res.end());
  return res;
}
map<long long, long long> prime_factors(long long n) {
  map<long long, long long> res;
  if (n == 1) {
    res[n] = 1;
    return res;
  }
  for (long long i = 2, _n = n; i * i <= _n; ++i) {
    while (n % i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if (n != 1) res[n] = 1;
  return res;
}
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
long long fac[MAXN], finv[MAXN], inv[MAXN];
void math_init() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (long long i = 2; i < MAXN; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
  int n;
  cin >> n;
  vector<lint> a(n);
  vector<lint> b(n);
  map<tuple<lint, lint, lint>, lint> mp;
  map<tuple<lint, lint, lint>, lint> inv;
  lint ex1 = 0;
  lint ex2 = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    lint mode = -1;
    if (a[i] > 0 and b[i] > 0) {
      mode = 1;
    } else if (a[i] < 0 and b[i] < 0) {
      mode = 1;
    }
    if (a[i] == 0 and b[i] == 0) continue;
    if (a[i] == 0) {
      ex1++;
      continue;
    }
    if (b[i] == 0) {
      ex2++;
      continue;
    }
    a[i] = (lint)abs(a[i]);
    b[i] = (lint)abs(b[i]);
    lint g = gcd(a[i], b[i]);
    mp[make_tuple(a[i] / g, b[i] / g, mode)]++;
    inv[make_tuple(b[i] / g, a[i] / g, mode)]++;
  }
  lint ans = modpow(2, ex1) + modpow(2, ex2) - 1 + MOD;
  ans %= MOD;
  for (auto e : mp) {
    lint p, r, mode;
    tie(p, r, mode) = e.first;
    lint c1 = e.second;
    lint c2 = inv[make_tuple(p, r, -mode)];
    if (c2 == 0 or mode == 1) {
      lint mul = modpow(2, c1) + modpow(2, c2) - 1 + MOD;
      mul %= MOD;
      ans *= mul;
      ans %= MOD;
    }
  }
  ans = (ans + MOD - 1) % MOD;
  cout << ans << endl;
  return 0;
}
