#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1e9 + 7;
constexpr long long int inf = 1LL << 60;
template <typename S, typename T>
inline void chmax(S &a, const T &b) {
  if (a < b) a = b;
}
template <typename S, typename T>
inline void chmin(S &a, const T &b) {
  if (a > b) a = b;
}
long long int modpow(long long int a, long long int n, long long int p) {
  if (n == 0) return 1;
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  long long int t = modpow(a, n / 2, p);
  return (t * t) % p;
}
long long int modinv(long long int a, long long int m) {
  if (m == 0) return (long long int)1;
  long long int b = m, u = 1, v = 0;
  while (b) {
    long long int t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
long long int fac[510000], finv[510000], inv[510000];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < 510000; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long int COM(long long int n, long long int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long int com(long long int n, long long int m) {
  if (n < m || n <= 0 || m < 0) {
    return 0;
  }
  if (m == 0 || n == m) {
    return 1;
  }
  long long int k = 1;
  for (long long int i = 1; i <= m; i++) {
    k *= (n - i + 1);
    k %= MOD;
    k *= modinv(i, MOD);
    k %= MOD;
  }
  return k;
}
long long int rad(long long int u, long long int p) {
  long long int cnt = 0;
  while (u % p == 0) {
    u /= p;
    cnt++;
  }
  return cnt;
}
long long int gcd(long long int x, long long int y) {
  if (x == 0) return y;
  return gcd(y % x, x);
}
int main() {
  long long int n;
  cin >> n;
  vector<pair<long long int, long long int> > vec{};
  map<pair<long long int, long long int>, long long int> mp{};
  long long int t = 0;
  for (long long int i = 1; i <= (long long int)(n); i++) {
    long long int p, q;
    cin >> p >> q;
    long long int pp = abs(p);
    long long int qq = abs(q);
    if (pp != 0 && qq != 0) {
      long long int v = gcd(pp, qq);
      p /= v;
      q /= v;
    }
    if (q < 0 && p < 0) {
      p = -p;
      q = -q;
    }
    if (p < 0 && q > 0) {
      q = -q;
      p = -p;
    }
    if (p == 0 && q == 0) {
      t = 1;
      continue;
    }
    if (p == 0) q = 10;
    if (q == 0) p = 10;
    vec.push_back(make_pair(p, q));
    if (!mp.count(make_pair(p, q)))
      mp[make_pair(p, q)] = 1;
    else
      mp[make_pair(p, q)]++;
  }
  sort(vec.begin(), vec.end());
  long long int ans = 1;
  long long int p = 0;
  long long int q = 0;
  for (int i = 0; i < vec.size(); i++) {
    long long int pv = vec[i].first;
    long long int qv = vec[i].second;
    if (i && p == pv && q == qv) {
      continue;
    }
    p = pv;
    q = qv;
    long long int val = 0;
    if (mp[make_pair(p, q)] == 0) {
      continue;
    }
    val += modpow((long long int)2, mp[make_pair(p, q)], MOD);
    val %= MOD;
    long long int newp;
    long long int newq;
    if (p >= 0 && q >= 0) {
      newp = q;
      newq = -p;
    } else {
      newp = -q;
      newq = p;
    }
    if (mp.count(make_pair(newp, newq))) {
      val += modpow((long long int)2, mp[make_pair(newp, newq)], MOD);
      val--;
      mp[make_pair(newp, newq)] = 0;
      val %= MOD;
    }
    ans *= val;
    ans %= MOD;
    mp[make_pair(p, q)] = 0;
  }
  cout << ans - 1 + t << endl;
  return 0;
}
