#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

// repetition
//------------------------------------------
#define FOR(i, a, b) for (ll i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)
ll gcd(ll a, ll b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}

// modint: mod 計算を int を扱うように扱える構造体
template <int MOD>
struct Fp {
  long long val;
  constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
    if (val < 0) val += MOD;
  }
  constexpr int getmod() {
    return MOD;
  }
  constexpr Fp operator-() const noexcept {
    return val ? MOD - val : 0;
  }
  constexpr Fp operator+(const Fp& r) const noexcept {
    return Fp(*this) += r;
  }
  constexpr Fp operator-(const Fp& r) const noexcept {
    return Fp(*this) -= r;
  }
  constexpr Fp operator*(const Fp& r) const noexcept {
    return Fp(*this) *= r;
  }
  constexpr Fp operator/(const Fp& r) const noexcept {
    return Fp(*this) /= r;
  }
  constexpr Fp& operator+=(const Fp& r) noexcept {
    val += r.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  constexpr Fp& operator-=(const Fp& r) noexcept {
    val -= r.val;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr Fp& operator*=(const Fp& r) noexcept {
    val = val * r.val % MOD;
    return *this;
  }
  constexpr Fp& operator/=(const Fp& r) noexcept {
    long long a = r.val, b = MOD, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    val = val * u % MOD;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr bool operator==(const Fp& r) const noexcept {
    return this->val == r.val;
  }
  constexpr bool operator!=(const Fp& r) const noexcept {
    return this->val != r.val;
  }
  friend constexpr ostream& operator<<(ostream& os, const Fp<MOD>& x) noexcept {
    return os << x.val;
  }
  friend constexpr Fp<MOD> modpow(const Fp<MOD>& a, long long n) noexcept {
    if (n == 0) return 1;
    auto t = modpow(a, n / 2);
    t = t * t;
    if (n & 1) t = t * a;
    return t;
  }
};

const int MOD = 1000000007;
using mint = Fp<MOD>;

// a^n mod を計算する
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}

int main() {
  ll n;
  cin >> n;

  vector<pair<ll, ll>> pp, pm, mm;
  int count_zeros = 0;
  int count_zero_front = 0;
  int count_zero_back = 0;

  REP(i, n) {
    ll a, b;
    cin >> a >> b;

    if (a == 0 && b == 0) {
      count_zeros++;
    } else if (a == 0) {
      count_zero_front++;
    } else if (b == 0) {
      count_zero_back++;
    } else {
      ll g = gcd(abs(a), abs(b));
      ll record_a = abs(a / g);
      ll record_b = abs(b / g);
      pair<ll, ll> p = {record_a, record_b};
      if (a > 0 && b > 0) {
        pp.push_back(p);
      } else if (a < 0 && b < 0) {
        pp.push_back(p);
      } else {
        pm.push_back({record_b, record_a});
      }
    }
  }

  SORT(pp);
  SORT(pm);

  vector<pair<ll, ll>> pp_unique = pp;
  vector<pair<ll, ll>> pm_unique = pm;

  UNIQUE(pp_unique);
  UNIQUE(pm_unique);

  vector<pair<ll, ll>> intersection;
  // vector<int>::iterator it = // iterator is not needed anymore
  set_intersection(pp_unique.begin(), pp_unique.end(), pm_unique.begin(),
                   pm_unique.end(), inserter(intersection, intersection.end()));

  mint count_daburi = 1;
  int comusyo = 0;

  REP(i, intersection.size()) {
    // cout << intersection[i].first << " " << intersection[i].second << endl;
    pair<ll, ll> key = intersection[i];
    auto itr_lower_pp = lower_bound(pp.begin(), pp.end(), key);
    auto itr_upper_pp = upper_bound(pp.begin(), pp.end(), key);
    int cnt_pp = itr_upper_pp - itr_lower_pp;

    auto itr_lower_pm = lower_bound(pm.begin(), pm.end(), key);
    auto itr_upper_pm = upper_bound(pm.begin(), pm.end(), key);
    int cnt_pm = itr_upper_pm - itr_lower_pm;

    comusyo += cnt_pp + cnt_pm;
    count_daburi *= modpow(2, cnt_pp) + modpow(2, cnt_pm) - 1;
  }
  if (count_zero_back > 0 && count_zero_front > 0) {
    count_daburi *=
        modpow(2, count_zero_front) + modpow(2, count_zero_back) - 1;
    comusyo += count_zero_back + count_zero_front;
  }
  // ANS(count_daburi);
  mint ans = modpow(2, n - count_zeros - comusyo);
  ans *= count_daburi;
  ans -= 1;
  ans += count_zeros;

  ANS(ans);

  return 0;
}


Measured memory_bytes: 9460