#include <bits/stdc++.h>
using namespace std;
long long t;
long long n, m = 1000000007;
map<pair<long long, long long>, long long> ab[2];
long long zp, pz, zz;
long long ans = 1;
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long abbs(long long a) {
  if (a < 0) return -a;
  return a;
}
long long fast_p(long long a, long long b) {
  long long now = a, ans = 1;
  for (long long i = 0; i < 64; i++) {
    if ((1ll << i) & b) {
      ans *= now;
      ans %= m;
    }
    now = now * now % m;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  t = 1;
  for (int _ = 1; _ <= t; _++) {
    cin >> n;
    for (int i = 0; i < n; i++) {
      long long a, b;
      cin >> a >> b;
      if (a && b) {
        if ((a > 0 && b > 0) || (a < 0 && b < 0)) {
          long long gcdab = gcd(abbs(a), abbs(b));
          ab[0][make_pair((abbs(a) / gcdab), (abbs(b) / gcdab))]++;
          ab[1][make_pair((abbs(b) / gcdab), (abbs(a) / gcdab))] += 0;
        } else {
          long long gcdab = gcd(abbs(a), abbs(b));
          ab[0][make_pair((abbs(b) / gcdab), (abbs(a) / gcdab))] += 0;
          ab[1][make_pair((abbs(a) / gcdab), (abbs(b) / gcdab))]++;
        }
      } else {
        if (a) {
          pz++;
        } else if (b) {
          zp++;
        } else {
          zz++;
        }
      }
    }
    ans *= (fast_p(2, pz) + fast_p(2, zp) - 1);
    ans %= m;
    while (ab[0].size()) {
      auto now = ((ab[0]).begin())->first;
      auto won = make_pair((now.second), (now.first));
      ans *= (fast_p(2, ab[0][now]) + fast_p(2, ab[1][won]) - 1);
      ans %= m;
      ab[0].erase(now);
      ab[1].erase(won);
    }
    cout << (ans - 1 + zz) % 1000000007 << '\n';
  }
  return 0;
}
