#include <bits/stdc++.h>
using namespace std;
int N;
vector<long long> A;
vector<long long> B;
vector<long double> L;
vector<long double> R;
void input() {
  cin >> N;
  A.resize(N);
  B.resize(N);
  L.resize(N);
  R.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    L[i] = A[i] / B[i];
    R[i] = -B[i] / A[i];
  }
}
void solve() {
  map<long long, int> dic;
  for (int i = 0; i < N; i++) {
    dic[L[i]] += 0;
    dic[R[i]] += 0;
  }
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += dic[R[i]];
    dic[L[i]]++;
  }
  long long fin;
  fin = N * (N - 1);
  cout << (fin - ans) % 10000000007 << endl;
}
int main() {
  input();
  solve();
  return 0;
}
