#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
long long par_UF[0];
long long rank_UF[0];
long long mod_pow(long long x, long long n, long long mod) {
  if (n == 0) return 1;
  long long res = mod_pow(x * x % mod, n / 2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}
int main() {
  long long n;
  cin >> n;
  map<long double, bool> d;
  long double a[n], b[n];
  for (long long int i = 0; i < n; i++) cin >> a[i] >> b[i];
  vector<long double> c(n);
  long long zz = 0, zo = 0, oz = 0;
  for (long long int i = 0; i < n; i++) {
    if (a[i] != 0 && b[i] != 0)
      c[i] = a[i] / b[i];
    else
      c[i] = inf + 1;
    if (a[i] == 0 && b[i] == 0) zz++;
    if (a[i] == 0 && b[i] != 0) zo++;
    if (a[i] != 0 && b[i] == 0) oz++;
  }
  sort(c.begin(), c.end());
  vector<pair<long long, long long>> vv;
  for (long long int i = 0; i < n; i++) {
    if (!d[c[i]]) {
      long long s = lower_bound(c.begin(), c.end(), -1 / c[i]) - c.begin();
      long long t = upper_bound(c.begin(), c.end(), -1 / c[i]) - c.begin();
      if (t - s > 0) {
        long long s2 = lower_bound(c.begin(), c.end(), c[i]) - c.begin();
        long long t2 = upper_bound(c.begin(), c.end(), c[i]) - c.begin();
        vv.push_back(pair<long long, long long>(t - s, t2 - s2));
        d[c[i]] = true;
        d[-1 / c[i]] = true;
      }
    }
  }
  vv.push_back(pair<long long, long long>(oz, zo));
  long long mod = 1000000007;
  long long ans = 1;
  long long sum = 0;
  for (long long int i = 0; i < vv.size(); i++) {
    long long aa = vv[i].first;
    long long bb = vv[i].second;
    sum += aa + bb;
    ans *= (mod_pow(2, aa + bb, mod) -
            (mod_pow(2, aa, mod) - 1) * (mod_pow(2, bb, mod) - 1));
    ans %= mod;
  }
  ans *= mod_pow(2, n - sum, mod);
  ans -= (mod_pow(2, zz, mod) - 1) * (mod_pow(2, n - zz, mod)) - zz;
  cout << (ans % mod - 1) << endl;
}
