#include <bits/stdc++.h>
using namespace std;
long long p = 1000000007;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long modpro(long long x, long long y, long long z = 1) {
  x %= p;
  y %= p;
  z %= p;
  long long res = (x * y) % p;
  res = (res * z) % p;
  return res;
}
long long modadd(long long x, long long y, long long z = 0) {
  x %= p;
  y %= p;
  z %= p;
  long long res = (x + y) % p;
  res = (res + z) % p;
  return res;
}
long long pow_mod_p(long long a, long long b) {
  a = a % p;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % p;
    b = b >> 1;
    a = (a * a) % p;
  }
  return res;
}
void func() {
  long long n;
  cin >> n;
  map<long double, long long> cnt;
  long long cnta = 0, cntb = 0, err = 0;
  for (long long i = 1; i < n + 1; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 || b == 0) {
      if (a == 0 && b == 0)
        err++;
      else if (a != 0)
        cntb++;
      else if (b != 0)
        cnta++;
      continue;
    }
    long long g = gcd(a, b);
    a /= g;
    b /= g;
    long double x = (long double)a / b;
    cnt[x]++;
  }
  long long ans = 1;
  for (auto i : cnt) {
    long double yy = i.first;
    long long pp = i.second;
    long double hh = -1 / yy;
    map<long double, long long>::iterator it = cnt.find(hh);
    if (it != cnt.end()) {
      long long qq = 0;
      qq = it->second;
      cnt[yy] = 0;
      cnt[hh] = 0;
      long long res = modadd(pow_mod_p(2, pp), pow_mod_p(2, qq));
      res = (res - 1 + p) % p;
      ans = modpro(ans, res);
    } else {
      long long res = pow_mod_p(2, pp);
      ans = modpro(ans, res);
      cnt[yy] = 0;
    }
  }
  long long zz = modadd(pow_mod_p(2, cnta), pow_mod_p(2, cntb));
  zz = (zz - 1 + p) % p;
  ans = modpro(ans, zz);
  ans = modadd(ans, err);
  ans = (ans - 1 + p) % p;
  cout << ans;
  cout << "\n";
}
int main() {
  {
    ios ::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  }
  long long ntc = 1;
  for (long long i = 1; i < ntc + 1; i++) {
    func();
  }
  return 0;
}
