#include <bits/stdc++.h>
using namespace std;
const int MAXN = 234567;
const long long MOD = (long long)1e9 + 7;
long long pw2[MAXN];
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long mul(long long a, long long b) { return (a * b) % MOD; }
int main() {
  pw2[0] = 1;
  for (int i = 1; i < MAXN; i++) pw2[i] = (pw2[i - 1] * 2) % MOD;
  int N;
  scanf("%d", &N);
  map<pair<long long, long long>, int> mp;
  long long a0b0 = 0, a0 = 0, b0 = 0;
  for (int i = 0; i < N; i++) {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    if (a == 0 && b == 0)
      a0b0++;
    else if (a == 0)
      a0++;
    else if (b == 0)
      b0++;
    else {
      int coef = 1;
      if (a * b < 0) coef = -1;
      a = abs(a), b = abs(b);
      long long g = gcd(a, b);
      a /= g, b /= g;
      mp[make_pair(coef * a, b)]++;
    }
  }
  long long ans = 1;
  set<pair<long long, long long> > used;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    long long a = it->first.first, b = it->first.second;
    if (used.count(it->first)) continue;
    int coef = -1;
    if (a < 0) {
      coef = 1;
      a *= -1;
    }
    pair<long long, long long> rv = make_pair(coef * b, a);
    if (!mp.count(rv)) {
      ans = (ans * pw2[it->second]) % MOD;
      continue;
    }
    long long tmp = (pw2[it->second] + pw2[mp[rv]] - 1) % MOD;
    used.insert(rv);
    ans = (ans * tmp) % MOD;
  }
  ans = mul(ans, (pw2[a0] + pw2[b0] - 1) % MOD) % MOD;
  printf("%lld\n", (ans - 1 + MOD + a0b0) % MOD);
  return 0;
}
