#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
long long n, m;
map<double, long long> m_p;
long long a[200010], b[200010];
int main() {
  cin >> n;
  for (long long i = 0; i < (n); i++) {
    cin >> a[i] >> b[i];
    double d = double(a[i] * 1.000000000000 / (b[i] * 1.000000000000));
    m_p[d]++;
  }
  long long ans = 0;
  for (long long i = 0; i < (n); i++) {
    double d = double(a[i] * 1.000000000000 / (b[i] * 1.000000000000));
    long long x = m_p[-d] + m_p[-(1 * 1.000000000000 / d)];
    if (-d == -1) {
      x -= m_p[-d];
    }
    ans -= (x * (x + 1) / 2 * (n - x - 1) * (n - x) / 2) % 100000007;
  }
  long long ans2 = 1;
  for (long long i = 0; i < (n); i++) {
    ans2 *= 2;
    ans2 %= 100000007;
  }
  ans2 -= 1;
  if (ans2 == -1) {
    ans2 += 100000007;
  }
  ans2 += ans;
  if (ans2 < 0) ans2 += 100000007;
  cout << ans2;
  return 0;
}
