#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
template <typename T>
void chmin(T &a, const T &b) {
  a = min(a, b);
}
template <typename T>
void chmax(T &a, const T &b) {
  a = max(a, b);
}
const long long mod = 1e9 + 7;
map<pair<long long, long long>, long long> mp;
map<pair<long long, long long>, bool> used;
long long powmod(long long px, long long py, long long pmod) {
  if (py == 0) return 1;
  if (py % 2 == 0)
    return powmod((px * px) % pmod, py / 2, pmod);
  else
    return (px * powmod(px, py - 1, pmod)) % pmod;
}
long long mygcd(long long x, long long y) {
  if (y == 0) return x;
  return mygcd(y, x % y);
}
int main() {
  long long n, a[200005], b[200005], g, as = 0, bs = 0, dp[200005] = {0}, x,
                                        ans = 1, zs = 0;
  pair<long long, long long> mm;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    g = mygcd(abs(a[i]), abs(b[i]));
    a[i] /= g;
    b[i] /= g;
    if (a[i] < 0) {
      a[i] *= -1;
      b[i] *= -1;
    }
    if (a[i] == 0 && b[i] != 0) b[i] = -1;
    if (b[i] == 0 && a[i] != 0) a[i] = 1;
  }
  dp[0] = 0;
  for (long long i = 1; i <= n; i++) {
    if (a[i] != 0 || b[i] != 0) {
      mp[{a[i], b[i]}]++;
    } else
      zs++;
  }
  used[{0, 0}] = true;
  ans = zs + 1;
  for (long long i = 1; i <= n; i++) {
    if (used[{a[i], b[i]}]) continue;
    if (b[i] >= 0)
      if (used[{b[i], -a[i]}]) continue;
    if (b[i] < 0)
      if (used[{-b[i], a[i]}]) continue;
    if (b[i] >= 0) {
      ans = ans *
            (powmod(2, mp[{a[i], b[i]}], mod) +
             powmod(2, mp[{b[i], -a[i]}], mod) - 1 + mod) %
            mod;
      used[{b[i], -a[i]}] = true;
    } else {
      ans = ans *
            (powmod(2, mp[{a[i], b[i]}], mod) +
             powmod(2, mp[{-b[i], a[i]}], mod) - 1 + mod) %
            mod;
      used[{-b[i], a[i]}] = true;
    }
    used[{a[i], b[i]}] = true;
  }
  cout << (ans - 1) % mod << endl;
  return 0;
}
