#include <bits/stdc++.h>
using ll = long long;
using namespace std;
class modlong {
  ll val;
  static ll *invs, *facts, *finvs;
  bool initModlong() {
    invs[1] = facts[0] = facts[1] = finvs[0] = finvs[1] = 1;
    for (int i = 2; i <= 2000000; i++) {
      invs[i] = -invs[MOD % i] * (MOD / i) % MOD;
      facts[i] = facts[i - 1] * i % MOD;
      finvs[i] = finvs[i - 1] * invs[i] % MOD;
    }
    return true;
  }

 public:
  static ll MOD;
  modlong(ll init = 0) : val(init) {
    static bool call_once = initModlong();
    assert(call_once);
    if (val < 0 || val >= MOD) val %= MOD;
    if (val < 0) val += MOD;
  }
  inline ll toll() { return this->val; }
  void operator=(const modlong &r) { this->val = r.val; }
  void operator=(const ll &r) { *this = modlong(r); }
  modlong operator+(const modlong &r) {
    ll ans = this->val + r.val;
    if (ans >= MOD) ans -= MOD;
    return modlong(ans);
  }
  modlong operator-() {
    ll ans = MOD - this->val;
    return modlong(ans);
  }
  modlong operator-(const modlong &r) {
    modlong rr = r;
    return *this + (-rr);
  }
  modlong operator*(const modlong &r) {
    ll ans = this->val * r.val;
    return modlong(ans);
  }
  modlong inv() {
    assert(*this != 0);
    if (*this == 1) return modlong(1);
    modlong p, q = *this, m(0), n(1), r, c;
    p.val = MOD;
    while (q > 2000000) {
      r = p.val % q.val;
      c = m.val - n.val * (p.val / q.val);
      p = q, q = r, m = n, n = c;
    }
    return n * invs[q.val];
  }
  modlong operator/(const modlong &r) { return *this * modlong(r).inv(); }
  modlong operator%(const modlong &r) { return modlong(this->val % r.val); }
  void operator++() { ++this->val; }
  void operator++(int a) {
    a = 0;
    this->val++;
  }
  void operator--() { --this->val; }
  void operator--(int a) {
    a = 0;
    this->val--;
  }
  void operator+=(const modlong &r) { *this = *this + r; }
  void operator-=(const modlong &r) { *this = *this - r; }
  void operator*=(const modlong &r) { *this = *this * r; }
  void operator/=(const modlong &r) { *this = *this / r; }
  void operator%=(const modlong &r) { *this = *this % r; }
  modlong pow(long n) {
    if (n < 0)
      return inv().pow(-n);
    else if (n == 0)
      return modlong(1);
    modlong half = pow(n / 2);
    if (n % 2)
      return *this * half * half;
    else
      return half * half;
  }
  modlong pow(modlong n) { return pow(n.val); }
  modlong comb(modlong _k) {
    assert(this->val <= 2000000);
    const ll n = this->val, k = _k.val;
    if (k < 0 || k > n) return 0;
    if (k == 0 || k == n) return 1;
    return modlong(facts[n]) * finvs[k] * finvs[n - k];
  }
  modlong fact() {
    assert(this->val <= 2000000);
    return modlong(facts[this->val]);
  }
  friend bool operator<(const modlong &l, const modlong &r) {
    return l.val < r.val;
  }
  friend bool operator>(const modlong &l, const modlong &r) {
    return l.val > r.val;
  }
  friend bool operator==(const modlong &l, const modlong &r) {
    return l.val == r.val;
  }
  friend bool operator!=(const modlong &l, const modlong &r) {
    return !(l == r);
  }
  friend bool operator<=(const modlong &l, const modlong &r) {
    return !(l > r);
  }
  friend bool operator>=(const modlong &l, const modlong &r) {
    return !(l < r);
  }
  friend ostream &operator<<(ostream &os, const modlong &out) {
    os << out.val;
    return os;
  }
  friend istream &operator>>(istream &is, modlong &in) {
    ll inl;
    is >> inl;
    in.val = inl % modlong::MOD;
    return is;
  }
};
inline modlong modComb(ll n, ll k) { return modlong(n).comb(k); }
inline modlong modFact(ll n) { return modlong(n).fact(); }
ll *modlong::invs = new ll[2000000 + 1];
ll *modlong::facts = new ll[2000000 + 1];
ll *modlong::finvs = new ll[2000000 + 1];
ll modlong::MOD = (ll)1e9 + 7;
template <typename T>
T gcd(T a, T b) {
  if (a > b) {
    T buf = a;
    a = b;
    b = buf;
  }
  return a == 0 ? b : gcd(a, b % a);
}
using P = pair<ll, ll>;
int main() {
  int n;
  cin >> n;
  map<P, int> cnt;
  map<P, P> pairs;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) continue;
    ll g = gcd(abs(a), abs(b));
    a /= g;
    b /= g;
    cnt[{a, b}]++;
    pairs[minmax(abs(a), abs(b))] = {cnt[{a, b}] + cnt[{-a, -b}],
                                     cnt[{b, -a}] + cnt[{-b, a}]};
  }
  modlong ans = modlong(2).pow(n);
  for (auto &p : pairs) {
    ll k = p.second.first + p.second.second;
    ans /= modlong(2).pow(k);
    ans *= modlong(2).pow(k) - (modlong(2).pow(p.second.first) - 1) *
                                   (modlong(2).pow(p.second.second) - 1);
  }
  cout << ans - 1 << '\n';
  return 0;
}
