#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
const long long INF = 1LL << 60;
const double PI = 3.14159265358979323846;
const int NMAX = 200005;
using namespace std;
long long fact[NMAX + 12];
long long invfact[NMAX + 12];
long long pow(long long a, long long b) {
  if (b == 0) {
    return 1;
  } else if (b % 2 == 0) {
    long long d = pow(a, b / 2);
    return (d * d) % MOD;
  } else {
    long long d = pow(a, b - 1);
    return (a * d) % MOD;
  }
}
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  map<pair<long long, long long>, long long> ab, ba;
  long long zeros = 0, zeroa = 0, zerob = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0 && b[i] == 0) {
      zeros++;
      continue;
    }
    if (a[i] == 0) {
      auto p = make_pair(1, 0);
      if (ba.find(p) == ba.end()) {
        ba.insert(make_pair(p, 1));
      } else {
        ba[p]++;
      }
      continue;
    } else if (b[i] == 0) {
      auto p = make_pair(1, 0);
      if (ab.find(p) == ab.end()) {
        ab.insert(make_pair(p, 1));
      } else {
        ab[p]++;
      }
      continue;
    }
    long long g = gcd(a[i], b[i]);
    long long tmpa = a[i] / g;
    long long tmpb = b[i] / g;
    if (abs(tmpa) > abs(tmpb)) {
      if (tmpb < 0) {
        tmpa = 0 - tmpa;
        tmpb = 0 - tmpb;
      }
      auto p = make_pair(tmpa, tmpb);
      if (ab.find(p) == ab.end()) {
        ab.insert(make_pair(p, 1));
      } else {
        ab[p] += 1;
      }
    } else if (abs(tmpa) == abs(tmpb)) {
      if (tmpa == tmpb) {
        if (tmpa < 0) {
          tmpa = 0 - tmpa;
          tmpb = 0 - tmpb;
        }
        auto p = make_pair(tmpa, tmpb);
        if (ab.find(p) == ab.end()) {
          ab.insert(make_pair(p, 1));
        } else {
          ab[p] += 1;
        }
      } else {
        if (tmpb < 0)
          tmpb = 0 - tmpb;
        else
          tmpa = 0 - tmpa;
        auto p = make_pair(tmpb, tmpa);
        if (ba.find(p) == ba.end()) {
          ba.insert(make_pair(p, 1));
        } else {
          ba[p] += 1;
        }
      }
    } else {
      if (tmpa < 0) {
        tmpa = 0 - tmpa;
        tmpb = 0 - tmpb;
      }
      tmpb = 0 - tmpb;
      auto p = make_pair(tmpb, tmpa);
      if (ba.find(p) == ba.end()) {
        ba.insert(make_pair(p, 1));
      } else {
        ba[p] += 1;
      }
    }
  }
  long long ans = 1;
  for (auto it = ab.begin(); it != ab.end(); it++) {
    auto key = it->first;
    long long value = it->second;
    long long tmp = (pow(2ll, value)) % MOD;
    if (ba.find(key) != ba.end()) {
      long long match = 1;
      match = ba[key];
      tmp = tmp + (pow(2ll, match) - 1) % MOD;
    }
    ans *= tmp;
    ans %= MOD;
  }
  for (auto it = ba.begin(); it != ba.end(); it++) {
    auto key = it->first;
    long long value = it->second;
    if (ab.find(key) == ab.end()) {
      long long tmp = (pow(2ll, value)) % MOD;
      ans *= tmp;
      ans %= MOD;
    }
  }
  if (zeros != 0) {
    ans += zeros;
    ans %= MOD;
  }
  ans -= 1;
  cout << ans << endl;
  return 0;
}
