#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

template <typename T, typename U> T pow_fast(T x, U n) {
    T ret = (T)1;
    while(n) {
        if(n & (U)1) ret *= x;
        x *= x;
        n >>= 1;
    }
    return ret;
}

template <typename ModType, ModType MOD> struct ModInt {
    ModType val;
    ModInt() : val(0) {}
    ModInt(ModType x) : val(x % MOD) {
        if(val < 0) val += MOD;
    };
    operator ModType() const { return val; }
    ModInt &operator+=(const ModInt &m) {
        val += m.val;
        if(val >= MOD) val -= MOD;
        return *this;
    }
    ModInt &operator-=(const ModInt &m) {
        val -= m.val;
        if(val < 0) val += MOD;
        return *this;
    }
    ModInt &operator*=(const ModInt &m) {
        (val *= m.val) %= MOD;
        return *this;
    }
    ModInt &operator/=(const ModInt &m) {
        *this *= m.inverse();
        return *this;
    }
    ModInt operator+(const ModInt &m) const { return ModInt(*this) += m; }
    ModInt operator-(const ModInt &m) const { return ModInt(*this) -= m; }
    ModInt operator*(const ModInt &m) const { return ModInt(*this) *= m; }
    ModInt operator/(const ModInt &m) const { return ModInt(*this) /= m; }
    ModInt inverse() const { return pow_fast(*this, MOD - 2); }
    ModInt pow(ModType n) const {return pow_fast(*this, n); }

    friend std::ostream &operator<<(std::ostream &os, const ModInt &rhs) {
        os << rhs.val;
        return os;
    }
    friend std::istream &operator>>(std::istream &is, ModInt &rhs) {
        ModType value;
        is >> value;
        rhs = ModInt(value);
        return is;
    }
};

int main(){
    using mint = ModInt<ll, MOD>;
    int n;
    cin >> n;
    using T = tuple<ll, ll, bool>;
    map<T, int> mp;
    int zeroA = 0, zeroB = 0, zeroAB = 0;
    rep(i, n) {
        ll a ,b;
        cin >> a >> b;
        bool neg = false;
        if(a < 0) {
            neg = !neg;
            a = -a;
        }
        if(b < 0) {
            neg = !neg;
            b = -b;
        }
        ll g = gcd(a, b);
        if(g != 0) {
            a /= g;
            b /= g;
        }
        if(a == 0 && b == 0) zeroAB++;
        else if(a == 0) zeroA++;
        else if(b == 0) zeroB++;
        else mp[{a, b, neg}] += 1;
    }
    mint cnt = 1;
    set<T> used;
    for(auto&& p: mp) {
        if(used.count(p.fi)) continue;
        ll a, b;
        bool c;
        // auto [a, b, c] = p.fi;
        tie(a, b, c) = p.fi;
        T t{b, a, !c};
        if(mp.count(t) == 0) {
            cnt *= mint(2).pow(p.se);
        }
        else {
            auto q = mp[t];
            cnt *= mint(2).pow(p.se)+mint(2).pow(q)-mint(1);
            used.insert(t);
            // used.insert({a, b, c});
        }
    }
    cnt *= mint(2).pow(zeroA)+mint(2).pow(zeroB)-mint(1);
    cout << cnt - mint(1) + mint(zeroAB)<< '\n';
    
    return 0;
}

Measured memory_bytes: 19156