#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
long long jou(long long N, long long P) {
  if (P == 0) return 1;
  if (P % 2 == 0) {
    long long t = jou(N, P / 2);
    return t * t % 1000000007;
  }
  return (N * jou(N, P - 1)) % 1000000007;
}
int main() {
  int n;
  cin >> n;
  int az = 0;
  int bz = 0;
  int abz = 0;
  vector<long double> a(n);
  vector<long double> b(n);
  map<long double, int> p;
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 && b[i] != 0) az++;
    if (b[i] == 0 && a[i] != 0) bz++;
    if (a[i] == 0 && b[i] == 0) abz++;
    if (a[i] != 0 && b[i] != 0) {
      long double awb = a[i] / b[i];
      if (p.count(awb))
        p.at(awb)++;
      else
        p[awb] = 1;
    }
  }
  long long ans = 1;
  for (auto x : p) {
    if (p.count((0.0 - 1.0) / x.first)) {
      long long memo =
          jou(2, x.second) + jou(2, p.at((0.0 - 1.0) / x.first)) - 1;
      memo %= 1000000007;
      ans *= memo;
      ans %= 1000000007;
      p.erase((0.0 - 1.0) / x.first);
    } else {
      ans *= jou(2, x.second);
      ans % 1000000007;
    }
  }
  ans *= jou(2, az) + jou(2, bz) - 1;
  ans %= 1000000007;
  ans += abz;
  ;
  cout << (ans - 1) % 1000000007 << endl;
}
