#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using ll = long long;
class mod_ll {
 public:
  ll m_v;
  static const ll m_m = 100000007;
  mod_ll(ll v = 0) : m_v(v) {}
  mod_ll operator=(ll rhs) {
    m_v = rhs % m_m;
    return *this;
  }
  ll operator()() { return m_v; }
  mod_ll operator=(mod_ll rhs) {
    m_v = rhs.m_v;
    return *this;
  }
  mod_ll operator+=(ll rhs) {
    m_v = (m_v + rhs) % m_m;
    return *this;
  }
  mod_ll operator+=(mod_ll rhs) {
    m_v = (m_v + rhs.m_v) % m_m;
    return *this;
  }
  mod_ll operator+(mod_ll rhs) {
    auto ret = *this;
    return ret += rhs;
  }
  mod_ll operator*=(ll rhs) {
    m_v = (m_v * rhs) % m_m;
    return *this;
  }
  mod_ll operator*=(mod_ll rhs) {
    m_v = (m_v * rhs.m_v) % m_m;
    return *this;
  }
  mod_ll operator*(mod_ll rhs) {
    mod_ll ret = *this;
    return ret *= rhs;
  }
  mod_ll operator^(ll rhs) {
    mod_ll t = *this;
    mod_ll ret(1LL);
    for (; rhs > 0; rhs >>= 1) {
      if (rhs & 1) ret *= t;
      t *= t;
    }
    return ret;
  }
  mod_ll operator-(ll rhs) {
    mod_ll t = *this;
    t.m_v = (t.m_v + m_m - rhs) % m_m;
    return t;
  }
  mod_ll operator/=(mod_ll rhs) { return *this *= (rhs ^ (m_m - 2)); }
  mod_ll operator/=(ll rhs) {
    mod_ll t(rhs);
    return *this /= t;
  }
  mod_ll operator/(mod_ll rhs) {
    mod_ll ret = *this;
    return ret /= rhs;
  }
};
mod_ll mod_fact(int n) {
  static vector<mod_ll> memo(1);
  if (memo.size() <= n) {
    if (memo.size() == 1) {
      memo[0] = 1;
    }
    for (int i = memo.size(); i <= n; i++) {
      memo.push_back(memo.back() * i);
    }
  }
  return memo[n];
}
mod_ll mod_nCr(int n, int r) {
  mod_ll bunsi = mod_fact(n);
  mod_ll bunbo = mod_fact(n - r) * mod_fact(r);
  return bunsi / bunbo;
}
mod_ll mod_nPr(int n, int r) {
  mod_ll ret(1);
  for (int i = 0; i < r; i++) {
    ret *= (n - i);
  }
  return ret;
}
ll gcd(ll a, ll b) {
  ll c;
  while ((c = a % b)) {
    a = b;
    b = c;
  }
  return b;
}
using pll = pair<ll, ll>;
using vpll = vector<pll>;
int sign(ll v) {
  if (v < 0) return -1;
  if (v > 0) return 1;
  return 0;
}
void calc_i(mod_ll& ans, vi& cp, vi& cn, int d, mod_ll c) {
  if (d >= cp.size()) {
    printf(" +%lld\n", c());
    ans += c;
    return;
  }
  mod_ll t;
  mod_ll two(2);
  t = c * ((two ^ cp[d]) + (two ^ cn[d]) - 1);
  calc_i(ans, cp, cn, d + 1, t);
}
void calc(mod_ll& ans, vi& f, int n) {
  vi cp(n), cn(n);
  int zero = 0;
  for (int mf : f) {
    if (mf == 0) zero++;
    if (mf > 0) cp[mf]++;
    if (mf < 0) cn[-mf]++;
  }
  mod_ll c(zero + 1);
  mod_ll two(2);
  ans = 1;
  for (int i = 1; i < n; i++) {
    ans *= ((two ^ cp[i]) + (two ^ cn[i]) - 1);
  }
  ans = ans - 1;
}
int main(void) {
  int n;
  while (scanf("%d", &n) == 1) {
    map<pll, int> m;
    int id = 2;
    vi f(n);
    m[make_pair(0LL, 0LL)] = 0;
    m[make_pair(0LL, 1LL)] = 1;
    m[make_pair(1LL, 0LL)] = -1;
    for (int i = 0; i < n; i++) {
      ll a, b;
      scanf("%lld%lld", &a, &b);
      int sa = sign(a);
      int sb = sign(b);
      if (sa == 0) {
        if (sb == 0)
          f[i] = 0;
        else
          f[i] = 1;
        continue;
      } else if (sb == 0) {
        f[i] = -1;
        continue;
      }
      ll d = gcd(sa * a, sb * b);
      a /= d;
      b /= d;
      if (a < 0) a = -a, b = -b;
      pll t = make_pair(a, b);
      pll t_ = make_pair(-b, a);
      pll tabs = (b > 0) ? t : t_;
      auto it = m.find(tabs);
      if (it == m.end()) {
        f[i] = id;
        m[tabs] = id++;
      } else {
        f[i] = it->second;
      }
      if (b < 0) f[i] = -f[i];
    }
    mod_ll ans;
    calc(ans, f, id);
    printf("%lld\n", ans());
  }
  return 0;
}
