#include <bits/stdc++.h>
using namespace std;
int64_t Q = 1000000007;
int64_t ni(int64_t h) {
  int64_t N = h;
  int64_t a = 1, b = 0, c = 1;
  while (N > 0) {
    a *= 2;
    if (N % a != 0) {
      N -= a / 2;
      int64_t d = 2;
      for (int j = 0; j < b; j++) {
        d = d * d;
        d = d % Q;
      }
      c = c * d;
      c = c % Q;
    }
    b++;
  }
  return c;
}
int main() {
  int64_t M, Z = 1, z = 0, y = 0, f = 0;
  cin >> M;
  map<double, int64_t> m;
  for (int i = 0; i < M; i++) {
    double a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      f++;
    } else if (a == 0) {
      z++;
    } else if (b == 0) {
      y++;
    } else {
      m[a / b]++;
    }
  }
  for (auto x : m) {
    if (x.first < 0) {
      continue;
    } else if (m.count(-1 / x.first)) {
      Z = (Z * (ni(x.second) + ni(m.at(-1 / x.first)) - 1)) % Q;
      M -= (x.second + m.at(-1 / x.first));
    }
  }
  Z = (Z * (ni(y) + ni(z) - 1)) % Q;
  M -= (y + z + f);
  Z = (Z * ni(M)) % Q;
  cout << (Z + f - 1) % Q << endl;
}
