#include <bits/stdc++.h>
using namespace std;
static const int mod = 1000000007;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  scanf("%d", &n);
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++) scanf("%lld %lld", &a[i], &b[i]);
  int bothZeroCount = 0, aZeroCount = 0, bZeroCount = 0;
  map<pair<long long, long long>, int> pos, neg;
  for (int i = 0; i < n; i++)
    if (a[i] == 0 && b[i] == 0)
      bothZeroCount++;
    else if (a[i] == 0) {
      aZeroCount++;
    } else if (b[i] == 0) {
      bZeroCount++;
    } else if ((a[i] < 0 && b[i] > 0) || (a[i] > 0 && b[i] < 0)) {
      long long u = abs(a[i]), v = abs(b[i]);
      long long d = gcd(u, v);
      u /= d, v /= d;
      pair<long long, long long> p = {u, v};
      if (!neg.count(p))
        neg.insert({p, 1});
      else
        neg[p]++;
    } else {
      long long u = a[i], v = b[i];
      long long d = gcd(u, v);
      u /= d, v /= d;
      pair<long long, long long> p = {u, v};
      if (!pos.count(p))
        pos.insert({p, 1});
      else
        pos[p]++;
    }
  vector<int> two(n + 1);
  two[0] = 1;
  for (int i = 1; i < two.size(); i++) two[i] = two[i - 1] * 2 % mod;
  long long ans = 1;
  for (auto p : pos) {
    pair<long long, long long> q1 = p.first;
    pair<long long, long long> q2 = {q1.second, q1.first};
    if (neg.count(q2)) {
      long long t = ((two[p.second] + two[neg[q2]]) % mod + mod - 1) % mod;
      ans = ans * t % mod;
    } else {
      ans = ans * two[p.second] % mod;
    }
  }
  for (auto p : neg) {
    pair<long long, long long> q1 = p.first;
    pair<long long, long long> q2 = {q1.second, q1.first};
    if (!pos.count(q2)) ans = ans * two[p.second] % mod;
  }
  if (aZeroCount > 0 && bZeroCount > 0) {
    long long t = (two[aZeroCount] + two[bZeroCount] % mod + mod - 1) % mod;
    ans = ans * t % mod;
  } else if (aZeroCount) {
    ans = ans * two[aZeroCount] % mod;
  } else if (bZeroCount) {
    ans = ans * two[bZeroCount] % mod;
  }
  ans = (ans + bothZeroCount + mod - 1) % mod;
  printf("%lld\n", ans);
  return 0;
}
