#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5, M = 1e9 + 7, OO = 0x3f3f3f3f;
const double Pii = 3.14159265359;
long long n;
long long a, b, az, bz, pa, pz, tk, tkc;
long long fac[N], cc1[N], sc[N], cc2[N];
multiset<pair<long long, long long>> st;
vector<pair<long long, long long>> v;
set<pair<long long, long long>> vis;
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long power(long long a, long long b, long long m) {
  if (!b) return 1;
  long long t = power(a, b >> 1, m) % m;
  return ((t * t) % m * (b & 1 ? a : 1) % m) % m;
}
long long powermod(long long a, long long b, long long m) {
  if (!b) return 1;
  long long t = powermod(a, b >> 1, m) % m;
  return ((t * t) % m * (b & 1 ? a : 1) % m) % m;
}
long long modInverse(long long n, long long m) { return powermod(n, m - 2, m); }
void CC2(long long n) {
  cc2[0] = 1;
  for (int r = 1; r <= n; ++r)
    cc2[r] =
        (((fac[n] * modInverse(fac[r], M)) % M) * modInverse(fac[n - r], M)) %
        M;
}
void CC1(long long n) {
  cc1[0] = 1;
  for (int r = 1; r <= n; ++r)
    cc1[r] =
        (((fac[n] * modInverse(fac[r], M)) % M) * modInverse(fac[n - r], M)) %
        M;
}
void Fact(long long n) {
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % M;
}
long long calc(long long co1, long long co2) {
  CC1(co1);
  CC2(co2);
  bool flip1 = (co1 % 2 == 1);
  bool flip2 = (co2 % 2 == 1);
  long long ret1 = 0;
  long long ret2 = 0;
  long long twos = power(2, n - co1 - co2 - tk, M);
  for (int i = co2; i >= 1; --i) {
    if (flip2)
      ret2 += (cc2[i] * twos) % M;
    else
      ret2 -= (cc2[i] * twos) % M;
    flip2 = !flip2;
    twos = (twos * 2) % M;
  }
  for (int i = co1; i >= 1; --i) {
    if (flip1)
      ret1 += (cc1[i] * ret2) % M;
    else
      ret1 -= (cc1[i] * ret2) % M;
    flip1 = !flip1;
    ret2 = (ret2 * 2) % M;
  }
  return ret1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  Fact(n);
  for (int i = 0; i < n; ++i) {
    cin >> a >> b;
    if (a == 0 || b == 0) {
      if (a == 0 && b == 0)
        pz++;
      else if (a == 0)
        az++;
      else
        bz++;
    } else {
      bool neg;
      if ((a < 0) ^ (b < 0))
        neg = 1;
      else
        neg = 0;
      if (neg)
        a = -abs(a);
      else
        a = abs(a);
      b = abs(b);
      long long g = gcd(abs(a), abs(b));
      pair<long long, long long> p = {a / g, b / g};
      st.insert(p);
      v.push_back(p);
    }
  }
  tkc = 0;
  long long rr = 0;
  n -= pz;
  if (az && bz) {
    tk = az + bz;
    tkc = power(2, az, M) + power(2, bz, M);
    rr = calc(az, bz);
  }
  long long vs = v.size();
  for (int i = 0; i < vs; ++i) {
    pair<long long, long long> p1 = v[i];
    if (vis.count(p1)) continue;
    pair<long long, long long> p2;
    if (p1.first < 0)
      p2 = {abs(p1.second), abs(p1.first)};
    else
      p2 = {-abs(p1.second), abs(p1.first)};
    vis.insert(p1);
    vis.insert(p2);
    long long co1 = st.count(p1);
    long long co2 = st.count(p2);
    if (co1 && co2) {
      long long rc = calc(co1, co2);
      rr += ((tkc * rc) % M + rc) % M;
      tk += (co1 + co2);
      tkc += (power(2, co1, M) - 1);
      tkc %= M;
      tkc += (power(2, co2, M) - 1);
      tkc %= M;
    }
  }
  long long ans = ((power(2, n, M) - 1) + M - rr) % M;
  cout << ans << endl;
  return 0;
}
