#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
  return a = (a > b) ? b : a;
}
long long const INF = 1LL << 60;
long long const MOD = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ;
  long long N;
  cin >> N;
  vector<long long> A(N), B(N);
  for (long long i = 0; i < (N); i++) {
    cin >> A[i] >> B[i];
  }
  mint ans = 2;
  ans = ans.pow(N) - 1;
  vector<double> C(N);
  for (long long i = 0; i < (N); i++) {
    C[i] = ((double)A[i] / (double)B[i]);
  }
  sort((C).begin(), (C).end());
  long long neg_idx = lower_bound((C).begin(), (C).end(), 0.0) - C.begin();
  if (neg_idx == 0) {
    cout << ans << endl;
    return 0;
  }
  vector<pair<long long, long long>> idx_pairs;
  for (long long i = 0; i < (neg_idx); i++) {
    double key = -1.0 / C[i];
    auto itr = lower_bound((C).begin(), (C).end(), key);
    if (itr != C.end()) {
      long long idx = itr - C.begin();
      for (long long j = (idx); j < (N); j++) {
        if (C[j] - key < 1e-12) {
          pair<long long, long long> p = make_pair(i, j);
          idx_pairs.push_back(p);
        } else
          break;
      }
    }
  }
  long long p_size = ((int)(idx_pairs).size());
  for (long long bit = 1; bit < (1 << p_size); bit++) {
    long long cnt = 0;
    set<long long> idxs;
    for (long long i = 0; i < p_size; i++) {
      if (bit & (1 << i)) {
        idxs.insert(idx_pairs[i].first);
        idxs.insert(idx_pairs[i].second);
        cnt++;
      }
    }
    if (cnt % 2 == 1) {
      ans -= mint(2).pow(N - ((int)(idxs).size()));
    } else {
      ans += mint(2).pow(N - ((int)(idxs).size()));
    }
  }
  cout << ans << endl;
  return 0;
}
