#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
template <class T = long long>
using V = vector<T>;
template <class T = long long>
using PQ = priority_queue<T>;
template <class T = long long>
using PQG = priority_queue<T, V<T>, greater<T>>;
const long long MOD = 1000000007LL;
void in() {}
template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(move(tail)...);
}
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long get(map<pair<long long, long long>, long long>& m, long long a,
              long long b) {
  auto p = make_pair(a, b);
  if (m.find(p) == m.end()) return 0;
  long long c = m[p];
  m[p] = 0;
  return c;
}
void solve() {
  long long n;
  in(n);
  map<pair<long long, long long>, long long> m;
  for (int i = 0, i_len = (n); i < i_len; ++i) {
    long long a, b;
    in(a, b);
    long long g = gcd(a, b);
    m[make_pair(a / g, b / g)]++;
  }
  vector<pair<long long, long long>> v;
  for (auto&& t : m) {
    if (t.second == 0) continue;
    long long n1 = get(m, t.first.second, -t.first.first);
    long long n2 = get(m, -t.first.second, t.first.first);
    v.emplace_back(t.second, n1 + n2);
  }
  long long s = 1;
  for (int i = 0, i_len = (v.size()); i < i_len; ++i) {
    if (v[i].second == 0) {
      s = (s * modpow(2, v[i].first, MOD)) % MOD;
    } else {
      s = (s * ((modpow(2, v[i].first, MOD) + modpow(2, v[i].second, MOD) +
                 MOD - 1) %
                MOD)) %
          MOD;
    }
  }
  cout << (s + MOD - 1) % MOD << endl;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(numeric_limits<double>::max_digits10);
  solve();
  return 0;
}
