#include <bits/stdc++.h>
using namespace std;
long long mypow(long long a, long long b) {
  long long num = 1;
  while (b > 0) {
    b--;
    num *= a;
    num %= 1000000007;
  }
  return num;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  vector<double> dis;
  for (long long i = 0; i < n; i++) {
    dis.push_back((a[i] + .0) / b[i]);
    dis.push_back(-(b[i] + .0) / a[i]);
  }
  sort(dis.begin(), dis.end());
  long long same = 0;
  for (long long i = 0; i < dis.size() - 1; i++) {
    if (abs(dis[i] - dis[i + 1]) <= 0.000000001) {
      same++;
    }
  }
  long long ans = mypow(2, n) - 1;
  cout << ans - (same * (same + 1) / 2) % 1000000007 + 1 << endl;
  return 0;
}
