#include <bits/stdc++.h>
using namespace std;
class Mod {
 public:
  long long mod;
  long long kaijou[200005];
  long long inv[200005];
  Mod(long long m) {
    mod = m;
    kaijou[0] = 1;
    for (long long i = 1; i <= 200003; i++) {
      kaijou[i] = kaijou[i - 1] * i % mod;
      inv[i] = modpow(kaijou[i], mod - 2);
    }
  }
  long long modpow(long long a, long long p) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
      long long half = modpow(a, p / 2);
      return half * half % mod;
    } else
      return a * modpow(a, p - 1) % mod;
  }
  long long comb(long long n, long long r) {
    if (r > n - r) return comb(n, n - r);
    long long mul = 1;
    long long div = 1;
    for (int i = 0; i < r; i++) {
      mul *= n - i;
      mul %= mod;
      div *= i + 1;
      div %= mod;
    }
    return mul * modpow(div, mod - 2) % mod;
  }
  long long fcomb(long long n, long long r) {
    if (r > n - r) return fcomb(n, n - r);
    if (r == 0) return 1;
    return (kaijou[n] * inv[n - r] % mod) * inv[r] % mod;
  }
};
long long lgcd(long long x, long long y) {
  if (x == 0) return y;
  return lgcd(y % x, x);
}
long long N;
long long A[200005], B[200005];
map<pair<long long, long long>, bool> used;
map<pair<long long, long long>, long long> mp;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  Mod m(1e9 + 7);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    long long g = lgcd(abs(A[i]), abs(B[i]));
    A[i] /= g;
    B[i] /= g;
    if (A[i] < 0) {
      A[i] *= -1;
      B[i] *= -1;
    }
    mp[pair<long long, long long>(A[i], B[i])]++;
  }
  long long ans = 1;
  for (const auto& [key, value] : mp) {
    if (used[key]) continue;
    long long va = value;
    long long a = key.second, b = -key.first;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    used[pair<long long, long long>(a, b)] = true;
    used[key] = true;
    long long vb = mp[pair<long long, long long>(a, b)];
    ans *= (m.modpow(2, va) + m.modpow(2, vb) + m.mod - 1) % m.mod;
    ans %= m.mod;
  }
  cout << (ans + m.mod - 1) % m.mod << endl;
  return 0;
}
