#include <bits/stdc++.h>
using namespace std;
long long powe(long long a, long long b) {
  long long ret = 1;
  while (0 < b) {
    if ((b % 2) == 0) {
      a = (a * a) % 1000000007;
      b >>= 1;
    } else {
      ret = (ret * a) % 1000000007;
      b--;
    }
  }
  return ret;
}
int main() {
  long long n;
  double a, b, y, z;
  cin >> n;
  long long bothz = 0;
  long long az = 0;
  long long bz = 0;
  vector<double> as;
  vector<double> bs;
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      bothz++;
    } else if (a == 0) {
      az++;
    } else if (b == 0) {
      bz++;
    } else {
      y = a / b;
      z = b / a;
      as.push_back(y);
      bs.push_back(z);
    }
  }
  sort(as.begin(), as.end());
  sort(bs.begin(), bs.end());
  long long ans = 1;
  long long i = 0;
  vector<long long> reached(as.size(), 0);
  while (i < as.size()) {
    if (reached[i] == 0) {
      double x = -as[i];
      long long ind1 = lower_bound(bs.begin(), bs.end(), x) - bs.begin();
      long long ind2 = upper_bound(bs.begin(), bs.end(), x) - bs.begin();
      if (ind1 == ind2) {
        ans = (ans * 2) % 1000000007;
        i++;
      } else {
        long long ind3 = lower_bound(as.begin(), as.end(), -x) - as.begin();
        long long ind4 = upper_bound(as.begin(), as.end(), -x) - as.begin();
        ans = (ans * (powe(2, ind2 - ind1) + powe(2, ind4 - ind3) - 1)) %
              1000000007;
        long long ind5 = lower_bound(as.begin(), as.end(), 1 / x) - as.begin();
        long long ind6 = upper_bound(as.begin(), as.end(), 1 / x) - as.begin();
        for (long long j = ind5; j < ind6; j++) reached[j] = 1;
        i = ind4;
      }
    } else {
      i++;
    }
  }
  ans = (ans * (powe(2, az) + powe(2, bz) - 1)) % 1000000007;
  ans = (ans + bothz - 1) % 1000000007;
  cout << ans << endl;
}
