#include <bits/stdc++.h>
using namespace std;
template <typename T>
void DEBUG(T e) {
  if (true == false) return;
  std::cout << e << " ";
}
template <typename T>
void DEBUG(const std::vector<T> &v) {
  if (true == false) return;
  for (const auto &e : v) {
    std::cout << e << " ";
  }
  std::cout << std::endl;
}
template <typename T>
void DEBUG(const std::vector<std::vector<T> > &vv) {
  if (true == false) return;
  for (const auto &v : vv) {
    DEBUG(v);
  }
}
template <class T, class... Ts>
void DEBUG(T d, Ts... e) {
  if (true == false) return;
  DEBUG(d);
  DEBUG(e...);
}
template <class T>
void corner(bool flg, T hoge) {
  if (flg) {
    cout << hoge << endl;
    abort();
  }
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}
struct mint {
  long long x;
  mint(long long x = 0) : x((x % 1000000007 + 1000000007) % 1000000007) {}
  mint &operator+=(const mint a) {
    if ((x += a.x) >= 1000000007) x -= 1000000007;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += 1000000007 - a.x) >= 1000000007) x -= 1000000007;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= 1000000007;
    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 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(1000000007 - 2); }
  mint &operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
const long long MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (long long i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
}
long long COM(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % 1000000007) % 1000000007;
}
long long PERM(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[n - k] % 1000000007) % 1000000007;
}
long long MCOM(long long n, long long k) { return COM(n + k - 1, k); }
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
void solve(void) {
  long long N;
  cin >> N;
  map<pair<long long, long long>, long long> mp;
  long long ZA = 0, ZB = 0;
  long long ZC = 0;
  for (long long i = 0; i < N; i++) {
    long long A, B;
    cin >> A >> B;
    long long G = 1;
    if (A != 0 && B != 0) G = gcd(abs(A), abs(B));
    if (A == 0 && B != 0) {
      ZA++;
      continue;
    }
    if (A != 0 && B == 0) {
      ZB++;
      continue;
    }
    if (A == 0 && B == 0) {
      ZC++;
      continue;
    }
    if (A < 0 && B < 0)
      A *= -1, B *= -1;
    else if (A < 0 && B > 0)
      A *= -1, B *= -1;
    mp[make_pair(A / G, B / G)]++;
  }
  mint ANS = 1;
  for (auto &&x : mp) {
    long long C = 1;
    if (x.second == 0) continue;
    long long cp1, cp2;
    cp1 = x.first.second;
    cp2 = x.first.first * -1;
    if (cp1 < 0 && cp2 < 0) cp1 *= -1, cp2 *= -1;
    long long p1 = x.second;
    long long p2 = mp[make_pair(cp1, cp2)];
    long long c1 = 0, c2 = 0;
    if (p1 > 0) {
      mint t = 2;
      c1 = t.pow(p1).x - 1;
    }
    if (p2 > 0) {
      mint t = 2;
      c2 = t.pow(p2).x - 1;
    }
    C += c1 + c2;
    ANS *= C;
    mp[x.first] = 0;
    mp[make_pair(cp1, cp2)] = 0;
  }
  long long Z1 = 0, Z2 = 0;
  if (ZA > 0) Z1 = pow(2, Z1) - 1;
  if (ZB > 0) Z2 = pow(2, Z2) - 1;
  ANS *= 1 + Z1 + Z2;
  ANS += ZC;
  cout << ANS.x - 1 << endl;
  return;
}
int32_t main(int32_t argc, const char *argv[]) {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();
  return 0;
}
