#include <bits/stdc++.h>
using namespace std;
long ncrmodp(long n, long r, long p) {
  long ans = 1;
  for (long i = n - r + 1; i <= n; i++) {
    ans *= i;
    ans %= p;
  }
  long tmp = 1;
  for (long i = 2; i <= r; i++) {
    tmp *= i;
    tmp %= p;
  }
  for (long i = 1; i <= p - 2; i *= 2) {
    if (i & p - 2) {
      ans *= tmp;
      ans %= p;
    }
    tmp *= tmp;
    tmp %= p;
  }
  return ans;
}
long pow2modp(int n, long p) {
  long ans = 1;
  for (int i = 0; i < n; i++) {
    ans *= 2;
    ans %= p;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  vector<long> a(n);
  vector<long> b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  long const MOD = 1000000007;
  set<double> s;
  map<double, long> mapA;
  map<double, long> mapB;
  for (int i = 0; i < n; i++) {
    double tmpA = 0.0;
    if (b[i] != 0) tmpA = (double)a[i] / (double)b[i];
    double tmpB = 0.0;
    if (a[i] != 0) tmpB = (double)b[i] / (double)a[i];
    s.insert(tmpA);
    mapA[tmpA]++;
    mapB[tmpB]++;
  }
  int tmpp = 0;
  for (double d : s) {
    if (d < 0) tmpp++;
  }
  long ans = 1;
  for (double d : s) {
    if (d < 0) {
      ans *= (pow2modp(mapA[d], MOD) - 1 + pow2modp(mapB[-d], MOD));
      ans %= MOD;
    } else if (d == 0.0) {
      ans *= (mapA[d] + 1);
      ans %= MOD;
    } else {
      if (mapB[-d] == 0) {
        ans *= pow2modp(mapA[d], MOD);
        ans %= MOD;
      }
    }
  }
  if (ans != 0)
    ans--;
  else
    ans = MOD - 1;
  cout << ans << endl;
}
