#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> x;
  for (int i = 0; i < n; i++) {
    double z, y;
    cin >> z >> y;
    x[i] = z / y;
  }
  int c = 0;
  for (int j = 0; j < n; j++) {
    c += x.count(x[j] * (-1));
  }
  long long a = round(pow(2, n)), b = (round(pow(2, n - 1)));
  long long d = round(pow(-1, n - 1)), m = round(pow(10, 9)) + 7;
  int ans = (a - c * (b - d) / 3) % m;
  cout << ans << endl;
}
