#include <bits/stdc++.h>
using namespace std;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
template <typename T1, typename T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  os << "{" << p.first << ", " << p.second << "}";
  return os;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const int INF = (long long)1e9;
const long long INFLL = (long long)1e18 + 1;
const long long MOD = (long long)1e9 + 7;
const double PI = acos(-1.0);
struct mint {
  long long x;
  mint(long long _x = 0) : x((_x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint modpow(long long t) const {
    if (!t) return 1;
    mint a = modpow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return modpow(MOD - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
  friend std::ostream& operator<<(std::ostream& os, const mint& a) {
    os << a.x;
    return os;
  }
};
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  map<pair<int, pair<long long, long long>>, int> mp;
  for (int i = 0; i < int(N); ++i) {
    cin >> A[i] >> B[i];
    long long G = gcd(abs(A[i]), abs(B[i]));
    A[i] /= G;
    B[i] /= G;
    if ((A[i] < 0 && B[i] > 0) || (A[i] > 0 && B[i] < 0)) {
      mp[{-1, {abs(A[i]), abs(B[i])}}]++;
    } else if (A[i] == 0 || B[i] == 0) {
      mp[{0, {0, 0}}]++;
    } else {
      mp[{1, {abs(A[i]), abs(B[i])}}]++;
    }
  }
  mint ans = 1;
  for (auto p : mp) {
    int fugo = p.first.first;
    long long a = p.first.second.first;
    long long b = p.first.second.second;
    long long cnt = p.second;
    if (cnt == INF) continue;
    if (cnt == 0) continue;
    if (fugo == 0) {
      ans *= mint(2).modpow(cnt);
      continue;
    }
    pair<int, pair<long long, long long>> gyaku = {-fugo, {b, a}};
    if (mp[gyaku] > 0) {
      long long cnt2 = mp[gyaku];
      ans *= mint(2).modpow(cnt) + mint(2).modpow(cnt2) - 1;
      mp[gyaku] = INF;
    } else {
      ans *= mint(2).modpow(cnt);
    }
  }
  ans -= 1;
  cout << ans << endl;
}
