#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1e18;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const int mod = 1000000007;
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
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; }
int main() {
  long long n;
  cin >> n;
  map<pair<long long, long long>, int> mp;
  int tmp = 0;
  for (long long i = 0; i < (n); ++i) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      tmp += 1;
      continue;
    }
    long long d = gcd(abs(a), abs(b));
    a /= d;
    b /= d;
    if (a < 0) {
      a = -a;
      b = -b;
    }
    mp[make_pair(a, b)]++;
  }
  mint l = 1;
  long long ans = 1;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    auto it = *itr;
    pair<long long, long long> p = it.first;
    long long f = it.second;
    long long x = p.first;
    long long y = p.second;
    long long s = mp[make_pair(-y, x)];
    ans *= modpow(2, f) + modpow(2, s) - 1;
    it.second = 0;
    mp[{-y, x}] = 0;
  }
  ans += tmp;
  ans -= 1;
  cout << ans << endl;
  return 0;
}
