#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
static const size_t MAX_N = 1000001;
struct modll {
  long long x;
  modll() {}
  modll(int _x) : x(_x) {}
  operator int() const { return (int)x; }
  modll operator+(int y) { return (x + y + MOD) % MOD; }
  modll operator+=(int y) {
    x = (x + y + MOD) % MOD;
    return *this;
  }
  modll operator-(int y) { return (x - y + MOD) % MOD; }
  modll operator-=(int y) {
    x = (x - y + MOD) % MOD;
    return *this;
  }
  modll operator*(int y) { return (x * y) % MOD; }
  modll operator*=(int y) {
    x = (x * y) % MOD;
    return *this;
  }
  modll operator/(int y) { return (x * modpow(y, MOD - 2)) % MOD; }
  modll operator/=(int y) {
    x = (x * modpow(y, MOD - 2)) % MOD;
    return *this;
  }
  static modll modinv(int a) { return modpow(a, MOD - 2); }
  static modll modpow(int a, int b) {
    modll x = a, r = 1;
    for (; b; b >>= 1, x *= x)
      if (b & 1) r *= x;
    return r;
  }
};
modll combination(long long n, long long r) {
  static modll fact[MAX_N + 1], inv[MAX_N + 1];
  if (!fact[0]) {
    fact[0] = 1;
    for (int i = 1; i <= MAX_N; ++i) {
      fact[i] = fact[i - 1] * i;
    }
    inv[MAX_N] = modll::modinv(fact[MAX_N]);
    for (int i = MAX_N; i >= 1; --i) {
      inv[i - 1] = inv[i] * i;
    }
  }
  if (r > n) {
    return 0;
  }
  return (fact[n] * inv[r]) * inv[n - r];
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main(int argc, char* argv[]) {
  {
    long long n = -1, a, b;
    cin >> n;
    if (n < 0) return 0;
    map<pair<long long, long long>, long long> m;
    for (int i = 0; i < n; ++i) {
      cin >> a >> b;
      long long g = gcd(a, b);
      a /= g, b /= g;
      if (a < 0) {
      }
      m[pair<long long, long long>(a, b)] += 1;
    }
    set<pair<long long, long long> > s;
    modll ans = 1;
    for (auto kv : m) {
      if (s.find(kv.first) != s.end()) continue;
      s.insert(kv.first);
      pair<long long, long long> dis(kv.first.second, -kv.first.first);
      auto it = m.find(dis);
      long long dc = 0;
      if (it != m.end()) {
        dc += it->second;
        s.insert(dis);
      }
      dis = pair<long long, long long>(-kv.first.second, kv.first.first);
      it = m.find(dis);
      if (dc > 0) {
        modll x = modll::modpow(2, kv.second);
        modll y = modll::modpow(2, dc);
        x -= 1;
        y -= 1;
        x += y;
        x += 1;
        ans *= x;
      } else {
        ans *= modll::modpow(2, kv.second);
      }
    }
    ans -= 1;
    cout << ans << endl;
  }
  return 0;
}
