#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long w[400010];
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  constexpr int mod = 1000000007;
  w[0] = 1;
  for (int i = 0; i < 400000; i++) {
    w[i + 1] = w[i] * 2 % mod;
  }
  int N;
  cin >> N;
  long long Z = 0, AZ = 0, BZ = 0;
  map<pair<long long, long long>, long long> Mp, Mm;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a < 0) a *= -1, b *= -1;
    if (a == 0 || b == 0) {
      if (a == 0) AZ++;
      if (b == 0) BZ++;
      if (a == 0 && b == 0) Z++;
      continue;
    }
    long long g = gcd(a, abs(b));
    a /= g, b /= g;
    if (b > 0)
      Mp[{a, b}]++;
    else
      Mm[{-b, a}]++;
  }
  long long nz = 1;
  for (auto &[p, c] : Mp) {
    auto d = Mm[p];
    nz *= (w[c] + w[d] - 1) % mod;
    nz %= mod;
  }
  for (auto &[p, c] : Mm) {
    if (Mp.count(p)) continue;
    nz *= w[c];
    nz %= mod;
  }
  long long ans = nz - 1;
  ans += nz * (w[AZ - Z] - 1) % mod;
  ans += nz * (w[BZ - Z] - 1) % mod;
  ans += Z;
  cout << ans % mod << "\n";
  return 0;
}
