#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long double G(long double a) { return a; }
int P(int a, int b) {
  if (b == 0) return 1;
  if (b & 1) return (long long)P(a, b - 1) * a % mod;
  int t = P(a, b / 2);
  return (long long)t * t % mod;
}
int n, o;
long double a, b;
map<long double, int> ma[2];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a >> b;
    if (a != 0 || b != 0) {
      if (a == 0) {
        ++ma[0][0];
      } else if (b == 0) {
        ++ma[1][0];
      } else {
        long double x = G(a / b);
        b = G(-b / a);
        a = x;
        if (a < b) {
          ++ma[0][a];
        } else {
          ++ma[1][b];
        }
      }
    } else {
      ++o;
    }
  }
  long long fp = 1;
  for (pair<long double, int> e : ma[0]) {
    (fp *= (P(2, e.second) + P(2, ma[1][e.first]) - 1) % mod) %= mod;
  }
  for (pair<long double, int> e : ma[1]) {
    if (ma[0][e.first] == 0) {
      (fp *= P(2, e.second)) %= mod;
    }
  }
  (fp += o) %= mod;
  if (fp == 0)
    fp = mod - 1;
  else
    --fp;
  cout << fp << endl;
  return 0;
}
