#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;
const long long MOD = 1000000007;

typedef pair<int,int> pii;
#define fi first
#define se second
#define mp make_pair

int main(){
  int n;
  vector<double> r(n);
  rep(i, n){
    ll a, b;
    cin >> a >> b;
    r[i] = (double)a/b;
  }
  sort(all(r));

  vector<vector<int> > G(n, vector<int>());
  rep(i, n){
    double t = - 1.0 / r[i];
    auto p = lower_bound(all(r), t) - r.begin();
    while(r[p] != t){
      G.push_back(mp(i, p));
      p++;
    }
  }

  ll total = 0;
  vector<ll> sum(n, 0);
  rep(i, n){
    ll tmp = total;
    for(int nv : G[v]){
      tmp -= sum[nv];
    }
    sum[i] = tmp;
    total += tmp;
    total %= MOD;
  }

  cout << total << endl;

  return 0;
}
