#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1& a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1& a, T2 b) {
  if (a < b) a = b;
}
std::random_device rd;
std::mt19937 mt(rd());
constexpr long long MOD = 1e9 + 7;
constexpr long long MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr long long LINF = 1e18 + 1;
constexpr long long INF = 1e9 + 1;
long long gcd(long long x, long long y) {
  long long m = max(x, y), n = min(x, y);
  if (m % n == 0)
    return n;
  else
    return gcd(m % n, n);
}
pair<long long, long long> calc(long long A, long long B) {
  long long a = abs(A), b = abs(B);
  long long g = gcd(a, b);
  if (A * B > 0) {
    return {a / g, b / g};
  } else {
    return {-a / g, b / g};
  }
}
pair<long long, long long> rev(pair<long long, long long> p) {
  if (p.first < 0) {
    return {p.second, -p.first};
  } else
    return {-p.second, p.first};
}
const long long mod = 1000000007;
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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
void solve() {
  long long N;
  cin >> N;
  vector<long long> A(N), B(N);
  for (long long i = 0; i < (N); ++i) {
    cin >> A[i] >> B[i];
  }
  map<pair<long long, long long>, long long> mpA, mpB;
  long long a0 = 0, b0 = 0;
  for (long long i = 0; i < (N); ++i) {
    if (A[i] == 0 && B[i] == 0) {
    } else if (A[i] == 0) {
      a0++;
    } else if (B[i] == 0) {
      b0++;
    } else {
      mpA[calc(A[i], B[i])]++;
      mpB[calc(-B[i], A[i])]++;
    }
  }
  mint ans = 1;
  mint t = 2;
  ans *= (mint)(t.pow(a0) + t.pow(b0) - 1);
  set<pair<long long, long long> > done;
  for (auto x : mpA) {
    if (done.count(rev(x.first))) continue;
    long long ca = x.second, cb = mpB[(x.first)];
    ans *= ((mint)(t.pow(ca) + t.pow(cb) - 1));
    done.insert(x.first);
  }
  cout << ((mint)(ans - 1)) << endl;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}
