#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll

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; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
      x = (int) (1LL * x * p.x % mod);
      return *this;
  }

  ModInt &operator/=(const ModInt &p) {
      *this *= p.inverse();
      return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
      int a = x, b = mod, u = 1, v = 0, t;
      while(b > 0) {
          t = a / b;
          swap(a -= t * b, b);
          swap(u -= t * v, v);
      }
      return ModInt(u);
  }

  ModInt pow(int64_t n) const {
      ModInt ret(1), mul(x);
      while(n > 0) {
          if(n & 1) ret *= mul;
          mul *= mul;
          n >>= 1;
      }
      return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
      return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
      int64_t t;
      is >> t;
      a = ModInt< mod >(t);
      return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< MOD >;

template <typename T> T gcd(T a, T b) { while (a) { b %= a; swap(a, b); } return b; }

ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while ( n > 0) {
        if (n & 1) { res = res * x % mod; } // 最下位ビットが立っているときに x^(2^i) を掛ける
        x = x * x % mod;                    // x を順次 2 乗していく
        n >>= 1;
    }
    return res;
}

int N;
vector<int> A, B;

map< pair<int, int>, pair<int, int> > pat;

signed main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);

    cin >> N;
    A.resize(N);
    B.resize(N);

    modint both_zero(0);
    modint one(1), two(2);

    REP(i, N) {
        cin >> A[i] >> B[i];
        // A と B の符号が一緒
        if( (A[i] < 0 && B[i] < 0) ||
            (A[i] > 0 && B[i] > 0) ) {
            int a = abs(A[i]);
            int b = abs(B[i]);
            int div = gcd(a, b);
            a /= div;
            b /= div;
            pat[{a, b}].first++;
        }
        else if( (A[i] < 0 && B[i] > 0) ||
                 (A[i] > 0 && B[i] < 0) ) {
            int a = abs(A[i]);
            int b = abs(B[i]);
            int div = gcd(a, b);
            a /= div;
            b /= div;
            pat[{b, a}].second++;
        }
        else if(A[i] == 0 && B[i] == 0) {
            both_zero += one;
        }
        else if(A[i] == 0) {
            pat[{1, 0}].first++;
        }
        else if(B[i] == 0) {
            pat[{1, 0}].second++;
        }
        else {
            assert(false);
        }
    }

    modint ans(1);
    for(auto& p : pat) {
        modint cand = two.pow(p.second.first) + two.pow(p.second.second) - one;
        ans *= cand;
    }

    // 両方 0 のやつはそれを選ぶのみしかできない
    ans += both_zero;

    // 何も選ばないパターンを引く
    ans -= one;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 21856