#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1LL << 61;
long long mpow(long long x, long long n) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans = ans * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return ans;
}
int main() {
  long long n;
  cin >> n;
  vector<double> a(n), b(n);
  for (long long i = 0; i < n; i++) cin >> a[i] >> b[i];
  map<double, long long> cnta, cntb;
  long long sum = n;
  long long ans = 0;
  long long z = 0;
  long long za = 0;
  long long zb = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] * b[i] != 0) {
      double tmp = a[i] / b[i];
      cnta[tmp]++;
      tmp = -1 / tmp;
      cntb[tmp]++;
    } else if (a[i] == 0 && b[i] == 0) {
      sum--;
      z++;
    } else if (a[i] == 0) {
      za++;
    } else if (b[i] == 0) {
      zb++;
    }
  }
  vector<pair<long long, long long> > cnt;
  set<double> al;
  for (auto p : cnta) {
    al.insert(-1 / p.first);
    if (al.count(p.first)) continue;
    if (cntb[p.first]) cnt.push_back({p.second, cntb[p.first]});
  }
  if (za * zb) cnt.push_back({za, zb});
  for (auto p : cnt) {
    sum -= p.first + p.second;
  }
  ans = mpow(2, sum);
  for (auto p : cnt) {
    ans = (ans * (mpow(2, p.first) + mpow(2, p.second) - 1 + mod) % mod);
  }
  ans = (ans + z) % mod;
  cout << ans - 1 << endl;
}
