#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
template<typename T>
T chmin(T& l, T r) {
    return l = min(l, r);
}
template<typename T>
T chmax(T& l, T r) {
    return l = max(l, r);
}
struct ModInt {
    static const ll MOD = 1000000007;

    // constructors etc
    ModInt() :num(1ll) {}
    ModInt(ll num_) :num(num_%MOD) {}
    ModInt(const ModInt& modint) :num(modint.num%MOD) {}
    ll get()const { return num; }

    // operator etc
    // operator ll() const { return num; }
    // ll operator*() { return num; }
    ModInt& operator+=(const ModInt& r) { (num += r.num) %= MOD; return *this; }
    ModInt& operator-=(const ModInt& r) { (num += -r.num + MOD) %= MOD; return *this; }
    ModInt& operator*=(const ModInt& r) { (num *= r.num) %= MOD; return *this; }
    ModInt& operator/=(const ModInt& r) { (num *= r.inv().num) %= MOD; return *this; }
    ModInt pow(const ModInt& r)const {
        ll res = 1;
        ll x = num;
        ll n = r.num;
        while (n > 0) {
            if (n & 1)res = (res*x) % MOD;
            x = (x*x) % MOD;
            n >>= 1;
        }
        return res;
    }
    ModInt inv()const { return this->pow(MOD - 2); }

    ModInt operator+(const ModInt& r)const { return ModInt(*this) += r; }
    ModInt operator-(const ModInt& r)const { return ModInt(*this) -= r; }
    ModInt operator*(const ModInt& r)const { return ModInt(*this) *= r; }
    ModInt operator/(const ModInt& r)const { return ModInt(*this) /= r; }
    ModInt operator+(const ll& r)const { return *this + ModInt(r); }
    ModInt operator-(const ll& r)const { return *this - ModInt(r); }
    ModInt operator*(const ll& r)const { return *this * ModInt(r); }
    ModInt operator/(const ll& r)const { return *this / ModInt(r); }

private:
    ll num;
};
ostream& operator<<(ostream& stream, const ModInt& val) { stream << val.get(); return stream; }
// ============ template finished ============

pii unify(pii p) {
    if (p.first < 0 && p.second < 0) {
        p.first *= -1;
        p.second *= -1;
    }
    else if (p.first < 0) {
        p.first *= -1;
        p.second *= -1;
    }
    return p;
}

int main()
{
    ll N;
    cin >> N;

    ll zero = 0;
    map<pll, ll> mp;
    rep(i, N) {
        ll A, B;
        cin >> A >> B;
        if (A == 0 || B == 0)zero++;
        else {
            ll g = gcd(A, B);

            mp[unify({ A / g, B / g })]++;
        }
    }

    ModInt res(1);
    res *= ModInt(2).pow(zero);
    while (!mp.empty()) {
        auto itr = mp.begin();
        auto p = itr->first;
        auto cnt1 = itr->second;
        mp.erase(p);
        swap(p.first, p.second);
        p.first *= -1;
        p = unify(p);
        if (mp.find(p) == mp.end()) {
            res *= ModInt(2).pow(cnt1);
        }
        else {
            auto cnt2 = mp[p];
            mp.erase(p);
            res *= ModInt(2).pow(cnt1) + ModInt(2).pow(cnt2) - 1;
        }
    }

    cout << (res - 1) << endl;
    return 0;
}
