#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int main() {
  int n;
  cin >> n;
  vector<double> fish(n);
  vector<int> count(n, 0);
  for (int i = 0; i < n; i++) {
    double a, b;
    cin >> a >> b;
    fish[i] = a / b;
  }
  sort(fish.begin(), fish.end());
  for (int i = 1; i < n; i++) {
    double c = -1 / fish[i];
    auto iter = lower_bound(fish.begin(), fish.end(), c);
    long long index = iter - fish.begin();
    if (index < i) {
      count[i] = upper_bound(fish.begin(), fish.end(), c) -
                 lower_bound(fish.begin(), fish.end(), c);
    }
  }
  vector<int> dp(n);
  dp[0] = 2;
  for (int i = 1; i < n; i++) {
    if (count[i] == 0)
      dp[i] = 2 * dp[i - 1];
    else {
      int p = pow(2, count[i]);
      dp[i] = dp[i - 1] + dp[i - 1] / p;
    }
  }
  cout << (dp[n - 1] - 1) % 1000000007 << endl;
}
