#include <bits/stdc++.h>
using namespace std;
long long INFl = (long long)1e+18 + 1;
int INF = 1e+9 + 1;
template <unsigned int mod_>
struct ModInt {
  using uint = unsigned int;
  using long long = long long;
  using ull = unsigned long long;
  constexpr static uint mod = mod_;
  uint v;
  ModInt() : v(0) {}
  ModInt(long long _v) : v(normS(_v % mod + mod)) {}
  explicit operator bool() const { return v != 0; }
  static uint normS(const uint& x) { return (x < mod) ? x : x - mod; }
  static ModInt make(const uint& x) {
    ModInt m;
    m.v = x;
    return m;
  }
  ModInt operator+(const ModInt& b) const { return make(normS(v + b.v)); }
  ModInt operator-(const ModInt& b) const { return make(normS(v + mod - b.v)); }
  ModInt operator-() const { return make(normS(mod - v)); }
  ModInt operator*(const ModInt& b) const { return make((ull)v * b.v % mod); }
  ModInt operator/(const ModInt& b) const { return *this * b.inv(); }
  ModInt& operator+=(const ModInt& b) { return *this = *this + b; }
  ModInt& operator-=(const ModInt& b) { return *this = *this - b; }
  ModInt& operator*=(const ModInt& b) { return *this = *this * b; }
  ModInt& operator/=(const ModInt& b) { return *this = *this / b; }
  ModInt& operator++(int) { return *this = *this + 1; }
  ModInt& operator--(int) { return *this = *this - 1; }
  long long extgcd(long long a, long long b, long long& x, long long& y) const {
    long long p[] = {a, 1, 0}, q[] = {b, 0, 1};
    while (*q) {
      long long t = *p / *q;
      for (int i = 0; i < (int)3; i++) swap(p[i] -= t * q[i], q[i]);
    }
    if (p[0] < 0)
      for (int i = 0; i < (int)3; i++) p[i] = -p[i];
    x = p[1], y = p[2];
    return p[0];
  }
  ModInt inv() const {
    long long x, y;
    extgcd(v, mod, x, y);
    return make(normS(x + mod));
  }
  ModInt pow(long long p) const {
    if (p < 0) return inv().pow(-p);
    ModInt a = 1;
    ModInt x = *this;
    while (p) {
      if (p & 1) a *= x;
      x *= x;
      p >>= 1;
    }
    return a;
  }
  bool operator==(const ModInt& b) const { return v == b.v; }
  bool operator!=(const ModInt& b) const { return v != b.v; }
  friend istream& operator>>(istream& o, ModInt& x) {
    long long tmp;
    o >> tmp;
    x = ModInt(tmp);
    return o;
  }
  friend ostream& operator<<(ostream& o, const ModInt& x) { return o << x.v; }
};
using mint = ModInt<1000000007>;
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long A[200001], B[200001];
map<pair<long long, long long>, long long> awb, mbwa;
long long zeronum = 0;
mint twoth[200001];
int main() {
  int N;
  twoth[0] = 1;
  cin >> N;
  for (int i = 0; i < (int)N; i++) {
    twoth[i + 1] = twoth[i] * 2;
  }
  for (int i = 0; i < (int)N; i++) {
    cin >> A[i] >> B[i];
    long long g = gcd(abs(A[i]), abs(B[i]));
    if (g == 0)
      zeronum++;
    else {
      A[i] /= g, B[i] /= g;
      if ((A[i] >= 0) ^ (B[i] >= 0)) {
        awb[{-abs(A[i]), abs(B[i])}]++;
        mbwa[{abs(B[i]), abs(A[i])}]++;
        ;
        ;
      } else {
        awb[{abs(A[i]), abs(B[i])}]++;
        mbwa[{-abs(B[i]), abs(A[i])}]++;
        ;
        ;
      }
    }
  }
  mint ans = 1;
  for (auto x : awb) {
    long long n1 = x.second;
    long long n2 = mbwa[x.first];
    if (n1 > 0 && n2 > 0)
      ans *= (twoth[n1] + twoth[n2] - 1);
    else if (n1 == 0) {
    } else
      ans *= twoth[n1];
    x.second = 0;
    if (x.first.first < 0)
      awb[{x.first.second, -x.first.first}] = 0;
    else
      awb[{-x.first.second, x.first.first}] = 0;
    ;
  };
  ans += zeronum - 1;
  cout << ans << endl;
  return 0;
}
