#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template <typename T>
using V = vector<T>;
template <typename T>
using VV = vector<vector<T>>;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 + 99);
const vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
template <typename T, typename U>
inline bool chmin(T& t, const U& u) {
  if (t > u) {
    t = u;
    return 1;
  }
  return 0;
}
template <typename T, typename U>
inline bool chmax(T& t, const U& u) {
  if (t < u) {
    t = u;
    return 1;
  }
  return 0;
}
template <typename T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T, typename Y>
inline T mpow(T a, Y n) {
  T res = 1;
  for (; n; n >>= 1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}
template <typename T, typename Y>
ostream& operator<<(ostream& os, const pair<T, Y>& p) {
  return os << "{" << p.first << "," << p.second << "}";
}
template <typename T>
ostream& operator<<(ostream& os, const V<T>& v) {
  os << "{";
  for (auto e : v) os << e << ",";
  return os << "}";
}
template <typename... Args>
void debug(Args&... args) {
  for (auto const& x : {args...}) {
    cerr << x << ' ';
  }
  cerr << '\n';
}
long long modpow(long long a, long long n, long long MOD) {
  long long res = 1 % MOD;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  V<ll> a(0), b(0);
  ll x, y, z = 0;
  for (ll i = 0; i < (ll)(n); ++i) {
    cin >> x >> y;
    if (!x && !y)
      z++;
    else
      a.push_back(x), b.push_back(y);
  }
  n -= z;
  map<pair<ll, ll>, pair<ll, ll>> ma;
  ll ans = 1;
  for (ll i = 0; i < (ll)(n); ++i) {
    x = abs(a[i]), y = abs(b[i]);
    ll g;
    if (x == 0)
      g = y;
    else if (y == 0)
      g = x;
    else
      g = gcd(x, y);
    pair<int, int> p, q;
    if ((a[i] <= 0 && b[i] <= 0) || (a[i] >= 0 && b[i] >= 0)) {
      p = make_pair(abs(a[i]) / g, abs(b[i]) / g);
      q = make_pair(-abs(b[i]) / g, abs(a[i]) / g);
    } else {
      p = make_pair(-(abs(a[i]) / g), abs(b[i]) / g);
      q = make_pair(abs(b[i]) / g, abs(a[i]) / g);
    }
    if (p.first > 0)
      ma[p].first++;
    else
      ma[q].second++;
  }
  for (auto&& i : ma) {
    ans *= (modpow(2ll, i.second.first, mod) +
            modpow(2ll, i.second.second, mod) + mod - 1) %
           mod;
    ans %= mod;
  }
  ans += mod - 1;
  ans %= mod;
  cout << ans << '\n';
}
