#line 1 "/mnt/c/Users/leafc/dev/compro/lib/math/modint.hpp"
#include <cstdint>
#include <iostream>
#include <vector>
#ifndef MOD_INT
#define MOD_INT

template <std::uint_fast64_t MOD> class ModInt {
  using u64 = std::uint_fast64_t;

public:
  ModInt(const u64 val = 0) { value = val % MOD; }

  ModInt operator+(const ModInt rhs) const { return ModInt(*this) += rhs; }
  ModInt operator-(const ModInt rhs) const { return ModInt(*this) -= rhs; }
  ModInt operator*(const ModInt rhs) const { return ModInt(*this) *= rhs; }
  ModInt operator/(const ModInt rhs) const { return ModInt(*this) /= rhs; }

  ModInt &operator+=(const ModInt rhs) {
    value += rhs.value;
    if (value >= MOD) {
      value -= MOD;
    }
    return *this;
  }

  ModInt &operator-=(const ModInt rhs) {
    if (value < rhs.value) {
      value += MOD;
    }
    value -= rhs.value;
    return *this;
  }

  ModInt &operator*=(const ModInt rhs) {
    value = value * rhs.value % MOD;
    return *this;
  }

  ModInt &operator/=(ModInt rhs) {
    *this *= rhs.inv();
    return *this;
  }

  ModInt &operator++(int n) {
    value++;
    if (value >= MOD) {
      value -= MOD;
    }
    return *this;
  }

  ModInt &operator--(int n) {
    if (value == 0) {
      value += MOD;
    }
    value--;
    return *this;
  }

  ModInt inv() { return ModInt::pow(*this, MOD - 2); }

  static ModInt pow(ModInt base, long long int n) {
    ModInt res = ModInt(1);
    while (n) {
      if (n & 1) {
        res *= base;
      }
      base *= base;
      n /= 2;
    }
    return res;
  }

  static ModInt comb(ModInt n, ModInt r) { return comb(n.value, r.value); }

  static ModInt comb(int n, int r) {
    if (n < r)
      return ModInt(0);
    ModInt res = ModInt(1);
    for (int i = 0; i < r; i++) {
      res *= ModInt(n - i);
    }

    ModInt inv = ModInt(1);
    for (int i = 0; i < r; i++) {
      inv *= ModInt(r - i);
    }
    return res / inv;
  }

  u64 getValue() const { return value; }

private:
  u64 value;

  friend std::ostream &operator<<(std::ostream &out, const ModInt<MOD> &m) {
    out << m.value;
    return out;
  }

  friend std::istream &operator>>(std::istream &in, ModInt &m) {
    uint_fast64_t i;
    in >> i;
    m = ModInt(i);
    return in;
  }
};

#endif
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << "\n"; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 3 "abc168_e.cpp"

using mint = ModInt<1000000007>;

template <class T> T gcd(T n, T m) { return n ? gcd(m % n, n) : m; }

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  map<pair<pair<ll, ll>, bool>, int> mp;
  int az = 0, bz = 0;
  mint zero(0);
  REP(i, n) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    if (a == 0) {
      az++;
      continue;
    }
    if (b == 0) {
      bz++;
      continue;
    }

    ll g = gcd(abs(a), abs(b));
    mp[{{abs(a / g), abs(b / g)}, (a > 0) ^ (b > 0)}]++;
  }

  mint ans(1);
  for (const auto [key, val] : mp) {
    auto ma = key.first.first;
    auto mb = key.first.second;

    auto minus = mp[{{mb, ma}, !key.second}];
    ans *= mint::pow(mint(2), val) + mint::pow(mint(2), minus) - mint(1);
    mp[key] = 0;
    mp[{{mb, ma}, !key.second}] = 0;
  }
  ans *= mint::pow(mint(2), bz) + mint::pow(mint(2), az) - mint(1);

  ans += zero;
  cout << ans - 1 << endl;
}


Measured memory_bytes: 34660