#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9 + 100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
ll modpow(ll a, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
ll modinv(ll x) { return modpow(x, mod - 2); }
ll comb(ll n, ll k) {
  ll ans1 = 1;
  ll ans2 = 1;
  for (int i = (0); i < (k); i++) ans1 = ans1 * (n - i) % mod;
  for (int i = (0); i < (k); i++) ans2 = ans2 * (i + 1) % mod;
  return ans1 * modinv(ans2) % mod;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  ll n;
  cin >> n;
  vector<ld> a(n), b(n);
  vector<ld> ab(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    ab[i] = -b[i] / a[i];
  }
  sort((ab).begin(), (ab).end());
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans + comb(n, i)) % mod;
  }
  ll m = 0;
  for (int i = 0; i < n; i++) {
    ld search = a[i] / b[i];
    int idx1 = lower_bound(ab.begin(), ab.end(), search) - ab.begin();
    int idx2 = upper_bound(ab.begin(), ab.end(), search) - ab.begin();
    for (int j = 1; j <= idx2 - idx1; j++) {
      m = (m + comb(idx2 - idx1, j)) % mod;
    }
  }
  cout << ans - m / 2 << endl;
  return 0;
}
