#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> pow2(1000000, 1);
  for (int(i) = 0; (i) < (1000000); (i)++) {
    if (i == 0) continue;
    pow2[i] = pow2[i - 1] * 2LL;
    pow2[i] %= 1000000007;
  }
  long long N;
  cin >> N;
  map<long double, long long> ABcount;
  map<long double, long long> BAcount;
  set<long double> AB;
  long long zz = 0, z_ = 0, _z = 0;
  for (int(i) = 0; (i) < (N); (i)++) {
    long double A, B;
    cin >> A >> B;
    if (A == 0 && B == 0)
      zz++;
    else if (A == 0)
      z_++;
    else if (B == 0)
      _z++;
    else {
      ABcount[A / B]++;
      BAcount[B / A]++;
    }
  }
  long long ans = 1;
  auto it = ABcount.begin();
  while (it != ABcount.end()) {
    long double ABtmp = it->first;
    if (AB.find(ABtmp) == AB.end()) {
      AB.insert(ABtmp);
      AB.insert((long double)-1.0 / ABtmp);
      long long anstmp = 0;
      anstmp += pow2[ABcount[ABtmp]];
      anstmp += pow2[BAcount[-ABtmp]];
      anstmp--;
      anstmp += 1000000007;
      anstmp %= 1000000007;
      ans *= anstmp;
      ans %= 1000000007;
    }
    it++;
  }
  long long anstmp = 0;
  anstmp += pow2[z_];
  anstmp += pow2[_z];
  anstmp -= 1;
  ans *= anstmp;
  ans %= 1000000007;
  ans--;
  ans += zz;
  ans += 1000000007;
  ans %= 1000000007;
  cout << ans << endl;
  return 0;
}
