#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
int ctoi(const char c) {
  if ('0' <= c && c <= '9') return (c - '0');
  return -1;
}
int main() {
  long long N;
  cin >> N;
  vector<long double> A(N);
  vector<long double> B(N);
  map<long double, long long> m;
  for (long long i = 0; i < N; ++i) {
    cin >> A[i] >> B[i];
    long double ratio = B[i] / A[i];
    ++m[ratio];
  }
  long long ans = 0;
  for (long long i = 0; i < N; ++i) {
    long double ratio = B[i] / A[i];
    long double rratio = (-1) / ratio;
    long long no = m[rratio];
    --m[ratio];
    long long DOUBLE = pow(2, N - (i + 1) - no);
    ans += DOUBLE % 1000000007;
  }
  if (ans < 0) ans += 1000000007;
  cout << ans << endl;
}
