#include <bits/stdc++.h>
using namespace std;
long long mpower(long long a, long long b, long long c) {
  int z;
  if (b == 0) {
    z = 1;
    z %= c;
    return z;
  }
  if (b == 1) {
    z = a;
    z %= c;
    return z;
  } else {
    return (((mpower(a, b / 2, c)) * (mpower(a, b / 2, c)) % c) *
            mpower(a, b % 2, c) % c);
  }
}
int main() {
  long long mod = 1e9 + 7;
  long long ans = 1;
  int n;
  cin >> n;
  long double vec[n];
  long double a, b;
  map<long double, int> ma;
  map<long double, int> mab;
  map<long double, int> seen;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      vec[i] = 0;
      continue;
    }
    if (a == 0) {
      vec[i] = 0;
      mab[1]++;
      continue;
    }
    if (b == 0) {
      vec[i] = 0;
      mab[2]++;
      continue;
    }
    vec[i] = a / b;
    ma[a / b]++;
  }
  long long q = 0;
  for (int i = 0; i < n; i++) {
    q = 0;
    if (vec[i] == 0) {
      continue;
    }
    if (seen[vec[i]] == 1) {
      continue;
    }
    if (ma[-1 / vec[i]] == 0) {
      q = mpower(2, ma[vec[i]], mod);
      q %= mod;
      ans *= q;
      ans %= mod;
      ma[vec[i]] = 0;
      seen[vec[i]]++;
      continue;
    }
    q += mpower(2, ma[vec[i]], mod);
    q %= mod;
    q += mpower(2, ma[-1 / vec[i]], mod);
    q--;
    q %= mod;
    ans *= q;
    ans %= mod;
    ma[vec[i]] = 0;
    ma[-1 / vec[i]] = 0;
    seen[vec[i]]++;
    seen[-1 / vec[i]]++;
  }
  q = 0;
  q += mpower(2, mab[1], mod);
  q += mpower(2, mab[2], mod);
  q--;
  ans *= q;
  ans %= mod;
  cout << ans - 1 << endl;
}
