#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
ll Pow_remain(ll a, ll index, ll divider) {
  ll ret = 1;
  for (; index > 0; index /= 2, a = a * a % 1000000007) {
    if (index % 2 == 1) {
      ret = ret * a % 1000000007;
    }
  }
  return ret;
}
int main() {
  ll N;
  cin >> N;
  vector<long double> A(N), B(N);
  map<long double, int> tilt;
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    tilt[A[i] / B[i]]++;
  }
  ll ans = 0;
  for (auto i = tilt.begin(); i != tilt.end(); ++i) {
    ans += i->second * tilt[1.0 / i->first];
  }
  ans /= 2;
  ll Ans = Pow_remain(2, N, 100000007);
  cout << Ans - ans << endl;
  return 0;
}
